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 #14974 is a reply to message #14973] Sun, 23 March 2008 18:28 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13976
Registered: November 2005
Ultimate Member
Werner wrote on Sun, 23 March 2008 12:56

luzr wrote on Sun, 23 March 2008 14:11

Finish waits until all the work required by calling "Do" is finished.

...

... "CoWork::waitforfinish" ... is used for synchronization. If there are any unfinished jobs, Finish has to wait until they are finished.

...

... todo ... is not waiting job, it is *unfinished* job! (Includes waiting jobs and jobs that are currently being processed).


Thank you very much. This clarification was extremely helpful Very Happy . Indeed I misunderstood CoWorks's design Sad .

Do I get it right now when I assume that usage of this module just requires to

1.
create a CoWork instance, e. g.:
CoWork coWork;

2a.
assign a job, e. g.:
coWork.Do(a_job_in_form_of_a_callback);

or

2b.
assign a couple of jobs, e. g.:
coWork & job_0 & job_1 & job_2;

and *basically nothing more*? And that CoWork::Finish is *only* needed for synchronization purposes?

(I dumped all the other questions as "insignificant" Cool ).

Werner



Yes, but the primary usage is loop paralelization.

{
    CoWork co;
    for(int i = 0; i < n; i++)
        co & callback1(processI, i);
}


For example, imagine large Image brightness adjustment.... (and Finish in destructor enforces that the brightness for the full Image is adjusted after the block....)

Mirek

[Updated on: Sun, 23 March 2008 18:29]

Report message to a moderator

 
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: Thu May 09 23:21:16 CEST 2024

Total time taken to generate the page: 0.02879 seconds