yangpeixing
9 小时以前 027b75833ae1bc3bd1bb597b18c65c9177fa62d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace WIDESEA_StorageTaskServices
{
    public class PrintStatusContainer
    {
        // 线程安全锁(多线程访问必备)
        private readonly object _lockObj = new object();
        private bool _automaticPrint;
 
        /// <summary>
        /// 自动打印状态(线程安全)
        /// </summary>
        public bool AutomaticPrint
        {
            get
            {
                lock (_lockObj) return _automaticPrint;
            }
            set
            {
                lock (_lockObj) _automaticPrint = value;
            }
        }
    }
}