- , ThreadPool , . , AsyncIO, - , 2 TP .
, , service1 service2 CompletionEvents "true", , . ResetEvents, , .
The process pseudo-code can be:
Dictionary<string, bool> callCompleted = new Dictionary<string, bool>
string operation1Key = Guid.NewGuid().ToString();
string operation2Key = Guid.NewGuid().ToString();
callCompleted[operation1Key] = false;
callCompleted[operation2Key] = false;
bool waiting = true;
while (waiting) {
bool isFinished = true;
foreach(string operationKey in callCompleted.Keys) {
isFinished &= callCompleted[operationKey]
if (!isFinished) { break; }
}
waiting = !isFinished;
}
A little rude, because I don’t know the exact nature of how you make your calls, but it should work quite well.
source
share