Home » U++ Library support » U++ MT-multithreading and servers » CoWork buggy!?
Re: CoWork buggy!? [message #14965 is a reply to message #14946] |
Sun, 23 March 2008 08:18   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
Werner wrote on Fri, 21 March 2008 08:39 | I might be terribly wrong, but as far as I can see, CoWork doesn't work correctly - at least if there are less jobs than cpu cores.
// as "todo" is now "0", "coWork.Finish" which might be called directly ...
// ... or by "coWork.~CoWork" does nothing
// that means:
// although CoWork should be terminated, all Threads are still running ...
// ... and, as "p" is static, even "CoWork::Pool::~Pool" which kills the running Threads ...
// ... via "CoWork::Pool::DoJob" and "CoWork::Pool::ThreadRun" is called only ...
// ... when the application itself is terminated
[/code]
|
Well, not sure if I fully undestand the complaint, but if the issue is that Finish does not terminate threads, it is exactly what we wanted. Once created, threads are terminated only at app exit.
The reason is obvious - creating / terminating threads is somewhat expensive. So we have a pool of worker threads ready when next CoWork hits. And they are shared across all CoWorks as well, even nested.
Mirek
|
|
|
Goto Forum:
Current Time: Tue Apr 29 00:36:49 CEST 2025
Total time taken to generate the page: 0.00556 seconds
|