C#.Rihter. How to stop thread work ? Cancellation token

how do i exit from thread

static void Main(string[] args) { var tokenSource = new CancellationTokenSource(); ThreadPool.QueueUserWorkItem(o => ThreadWorker(tokenSource.Token, 1000)); Console.WriteLine(«Press <Enter> to cancel

Читать на сайте автора.

C#. Rihter. Use Thread from the thread pool

static void Main(string[] args) { Console.WriteLine(«this is main thread»); ThreadPool.QueueUserWorkItem(ThreadWorker, 123); Thread.Sleep(3000); } private static void ThreadWorker(object obj) { Thread.Sleep(1000); Console.WriteLine(«hi from thread pool

Читать на сайте автора.

С#. Foreground and Background threads

Foreground and background threads.

If background thread then application will not wait until it is over, in other case it will.

static void

Читать на сайте автора.

C#. Threads simple example

static void Main(string[] args) { Console.WriteLine(«inside thread id » + Thread.CurrentThread.ManagedThreadId); var otherThread = new Thread(ThreadWork); otherThread.Priority = ThreadPriority.Normal; otherThread.Start(5); otherThread.Join(); // wait for

Читать на сайте автора.

JS. Reject vs throw and catch vs rejectHandler

Both, reject and throw can be handled with catch

reject inside promise will be handled by 2-d argument of then, and if it is

Читать на сайте автора.