public void AddWork(DelegateWork work, OnWorkCompltedCallBack onWorkCompltedCallBack) { Thread thread = new Thread(() => { work(onWorkCompltedCallBack); }); lock (lck4ReadyThreads) { _readyThreads.Add(thread); } }
public void Work(OnWorkCompltedCallBack workCompeltedCallBack) { int i = 0; int j = 50; int result = 0; do { result += ++i; Thread.Sleep(10); } while (i < j); if (null != workCompeltedCallBack) { workCompeltedCallBack(result); } }