Home » U++ Library support » U++ MT-multithreading and servers » what about WorkQueue : public CoWork
Re: changed CoWork and derived WorkQueue [message #24910 is a reply to message #24907] |
Wed, 03 February 2010 21:58   |
 |
kohait00
Messages: 939 Registered: July 2009 Location: Germany
|
Experienced Contributor |
|
|
hi mirek,
i think i got your point. the only thing to ensure about a work queue instance (or a given CoWork instance) is, the instance has to ensure that no other task is dequeued (to be executed in another parallel thread of static pool) before the previous task posted to the queue has been completed.
semantically speaking: the taks posted/enqueued into a CoWork instance have per se nothing to do with the pool itself, which presents the ability to execute arbitrary things anyway.
so probably the following would be right:
to make the struct Pool not private part of CoWork, but maybe protected. so a derived WorkQueue can reuse the static pool,
it can derive protected from CoWork to hide away the public interface (for not using virtuals), since most part of CoWork is proteced anyway, the WorkQueue then basicly needs to provide the same interface (Do() and operator &()), which then simply invoke a Finish() before handing over to CoWork::Do(). one could also use a CoWork directly, before enqueing any further task, simply ensure the one before is finished...so this is almost what you provided some post before..with the scoped CoWork approach..the only difference is that the CoWork is not created all over again and again, but used the same instance.
but one draw back is there: invoking Finish before enqueuing new task implies that the posting thread is halted until a previous task has terminated..this is not the case with current WorkQueue, which always dequeus, but to 1 thread only, so no other task can run in the queue. but if meanwhile another task has been queued, it is then executed right after, without having the posting task to wait for completion of previous one.
maybe the WorkQueue should be a class of it self, dequeuing differently then the CoWork does..
i'll try that.. but generally speaking, does all that make any sense to you anyway?
thanks for the patience
kostah
|
|
|
 |
|
what about WorkQueue : public CoWork
By: kohait00 on Wed, 03 February 2010 07:26
|
 |
|
Re: what about WorkQueue : public CoWork
By: koldo on Wed, 03 February 2010 08:22
|
 |
|
Re: what about WorkQueue : public CoWork
By: kohait00 on Wed, 03 February 2010 08:58
|
 |
|
first, CoWork.h and CoWork.cpp cleanups
By: kohait00 on Wed, 03 February 2010 12:07
|
 |
|
WorkQueue
By: kohait00 on Wed, 03 February 2010 12:14
|
 |
|
Re: what about WorkQueue : public CoWork
By: mirek on Wed, 03 February 2010 12:36
|
 |
|
Re: what about WorkQueue : public CoWork
By: kohait00 on Wed, 03 February 2010 13:31
|
 |
|
changed CoWork and derived WorkQueue
By: kohait00 on Wed, 03 February 2010 15:03
|
 |
|
Re: changed CoWork and derived WorkQueue
By: mirek on Wed, 03 February 2010 15:08
|
 |
|
Re: changed CoWork and derived WorkQueue
By: kohait00 on Wed, 03 February 2010 15:14
|
 |
|
Re: changed CoWork and derived WorkQueue
By: mirek on Wed, 03 February 2010 20:45
|
 |
|
Re: changed CoWork and derived WorkQueue
By: kohait00 on Wed, 03 February 2010 21:58
|
 |
|
2 basic problems
By: kohait00 on Mon, 08 February 2010 22:29
|
 |
|
Re: changed CoWork and derived WorkQueue
By: mirek on Tue, 09 February 2010 10:56
|
 |
|
Re: changed CoWork and derived WorkQueue
By: kohait00 on Tue, 09 February 2010 15:14
|
 |
|
Re: changed CoWork and derived WorkQueue
By: mirek on Mon, 15 February 2010 12:49
|
 |
|
Re: changed CoWork and derived WorkQueue
By: kohait00 on Tue, 16 February 2010 14:44
|
 |
|
BUGFIX to WorkQueue
By: kohait00 on Thu, 18 February 2010 16:02
|
 |
|
Re: BUGFIX to WorkQueue
By: kohait00 on Fri, 19 February 2010 08:47
|
Goto Forum:
Current Time: Thu Aug 28 08:55:27 CEST 2025
Total time taken to generate the page: 0.07385 seconds
|