When working with applications that utilize lots of threads and those threads arent particularry long running we can stumble upon a problem that we may lose most of the processing time for thread context switches, so it would be desirable to do all of the processing on a limited number of threads, usualy this can be done using a queue of delegates that each thread will process, but sometimes we cannot have that and still w...
When working with multi threaded applications, we tend to spawn worker threads which can lead to ineffective code when not done correctly, for example threads will not get reused and will be recreated for each work items. The solution to all those problems is a ThreadPool which reuses threads and queues work items that are consumed by those threads. This sort of implementation while simple can have side effects as unless the pool Queue is immutable it will have to be locked each time an item Enqueued and...