Perhaps you have too many Delegate.BeginInvoke calls at once?

I am cleaning up old code converting it to work asynchronously.

psDelegate.GetStops decStops = psLoadRetrieve.GetLoadStopsByLoadID;
var arStops = decStops.BeginInvoke(loadID, null, null);
WaitHandle.WaitAll(new WaitHandle[] { arStops.AsyncWaitHandle });
var stops = decStops.EndInvoke(arStops);

The above is an example of what I'm doing for asynchronous operation. My plan is to work with 20 different delegates. Everyone will call BeginInvokeand wait until all of them are filled before the call EndInvoke.

My question is, will so many delegates work causing problems? I understand that BeginInvokeThreadPool uses to do the job and has a limit of 25 threads. 20 is under this restriction, but it is very likely that other parts of the system can also use any number of threads from ThreadPool.

Thank!

+3
source share
2

, ThreadPool . . , , . , .

, . , . 3 .

, 500 , . , 4 . , threadpool.

+2

MaxThreads - 250 , , BeginInvoke. . http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx. , , . , , , , .

.

, , , , .

+1

Source: https://habr.com/ru/post/1749757/


All Articles