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 #14968 is a reply to message #14965] Sun, 23 March 2008 11:38 Go to previous messageGo to previous message
Werner is currently offline  Werner
Messages: 234
Registered: May 2006
Location: Cologne / Germany
Experienced Member
luzr wrote on Sun, 23 March 2008 08:18

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

Ok, maybe I misunderstood the idea of "CoWork" Embarassed . If so, sorry for that Sad . After all there isn't any documentation and the code is written in a style which - well, let's say - I'm not familiar with Confused .

Anyway, this raises bags of questions of which the following 2 are my favorites:

1.

Under which conditions should "CoWork::Finish" be called?

2. (independent from the answer to question #1)

What is "CoWork::waitforfinish" for?

If "CoWork::Finish" is called there are 2 possibilities:

a) no waiting job, i. e. "todo == 0":

Nothing is done. "CoWork::waitforfinish" remains unchanged.

b) waiting job, i. e. "todo > 0", e. g. "todo == 1":

That means "Pool:jobs.GetCount == 1" too, because both "todo" and "jobs" are incremented by "CoWork::Do" and decremented by "CoWork::Pool::DoJob". That again means "CoWork::Pool::DoJob" increments "CoWork::waitforfinish".

The conclusion is: "CoWork::waitforfinish" is never decremented and might raise without limit Shocked .

Werner
 
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: Fri May 10 01:05:11 CEST 2024

Total time taken to generate the page: 0.03843 seconds