You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ikopylov edited this page Dec 26, 2014
·
1 revision
Qoollo ThreadSetManager
It is often required to start one or several threads to execute some process asynchronously. It is very simple to create a System.Threading.Thread instance and start it, but it is always painful to implement the proper stop mechanism. ThreadSetManager can help you with that.
Sample code:
// Our actionprivatestaticvoidThreadAction(CancellationTokentoken){while(!token.IsCancellationRequested){// do some workThread.Sleep(10);}}staticvoidMain(string[]args){// Create thread managervarthreadManager=newDelegateThreadSetManager(threadCount:2,name:"name",tokenThreadStartAction:ThreadAction);// Start threadsthreadManager.Start();// Stop threadsthreadManager.Stop(waitForStop:true);}