1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace OneNote2PDF
- {
- /// <summary>
- /// 全局 app 对象
- /// </summary>
- class App
- {
- public string inputDir = "";
- public string outputDir = "";
- private static App app;
- private static readonly object locker = new object(); // 对象锁标志
- public static App getInstance()
- {
- if (app == null)
- {
- lock (locker) //标志对象加锁,多线程内部代码会挂起
- {
- if (app == null)
- {
- app = new App();
- }
- }
- }
- return app;
- }
- }
- }
|