> I haven't done much fancy concurrency, but one idea that came to mind is this: > > * have a counter for instances of your probe thread > * have `synchronized` increment/decrement methods > * as each thread starts, it increments the counter > * as each thread finishes, it decrements the counter > * include a timeout in the thread so they return in a reasonable amount of > time > * have a while loop that quits when the counter is back to 0 > * now you have your result > > .hc
This had occured to me, and is pretty much how WaitGroups work in Go. Two issues though: * Doesn't a while() take 100% of the CPU on a thread? The good thing of WaitGroups is that they use channels, which block kinda like a read() and so consume no CPU. * Adding that manual waitgroup would bring up the total line count to over 100 lines. It really sounds like it could be done in a cleaner, easier and perhaps even faster way. -- Daniel Martí - [email protected] - http://mvdan.cc/ PGP: A9DA 13CD F7A1 4ACD D3DE E530 F4CA FFDB 4348 041C _______________________________________________ List info: https://lists.mayfirst.org/mailman/listinfo/guardian-dev To unsubscribe, email: [email protected]
