Commit b7e6b3e8 authored by 潘栩锋's avatar 潘栩锋 🚴

优化 不同的数据库,使用不同的 task 线程

parent 109e7b16
...@@ -541,8 +541,9 @@ namespace SQLite ...@@ -541,8 +541,9 @@ namespace SQLite
new Task((obj) => { new Task((obj) => {
var _sqls = obj as IEnumerable<string>; var _sqls = obj as IEnumerable<string>;
QueryTran(_sqls); QueryTran(_sqls);
}, queryList).Start(StepByStepTaskScheduler.Current); }, queryList).Start(Scheduler);
} }
TaskScheduler Scheduler { get; } = new StepByStepTaskScheduler();
List<string> holdQueryList = new List<string>(); List<string> holdQueryList = new List<string>();
bool isHoldQueryTran = false; bool isHoldQueryTran = false;
...@@ -945,7 +946,7 @@ namespace SQLite ...@@ -945,7 +946,7 @@ namespace SQLite
public static StepByStepTaskScheduler Instance { get; } = (StepByStepTaskScheduler)Current; public static StepByStepTaskScheduler Instance { get; } = (StepByStepTaskScheduler)Current;
private readonly BlockingCollection<Task> m_queue = new BlockingCollection<Task>(); private readonly BlockingCollection<Task> m_queue = new BlockingCollection<Task>();
StepByStepTaskScheduler() public StepByStepTaskScheduler()
{ {
//Thread thread = new Thread(Run); //Thread thread = new Thread(Run);
//thread.IsBackground = true;//设为为后台线程,当主线程结束时线程自动结束 //thread.IsBackground = true;//设为为后台线程,当主线程结束时线程自动结束
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment