Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous messageGo to previous message
mirek is currently online  mirek
Messages: 13980
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
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IsFinished() for CoWork
Next Topic: MT on Linux?
Goto Forum:
  


Current Time: Mon May 13 13:16:37 CEST 2024

Total time taken to generate the page: 0.02943 seconds