Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members  

RazorBack::MTqueue_ Class Reference

Class MTqueue_: this class sets up a priority queue that pipes "jobs" to a set of working threads. More...

#include <MTqueue.hh>

Collaboration diagram for RazorBack::MTqueue_:

Collaboration graph
[legend]
List of all members.

Public Methods

 MTqueue_ ()
 Init to empty.

template<class Fwditer_> void submit_jobs (Fwditer_ First, Fwditer_ Last)
 submit_jobs(First, Last): pushes a range of job objects between the iterators First and Last onto the priority queue and waits until all jobs have been completed by the working threads. More...

void wait_4job () const
 wait_4job(): this is to be used by the working threads to wait until someone pushes a job onto the queue.

MTqueue_::Jobq_ pop_job ()
 pop_job(): takes a job object wrapper from the priority queue, removes it from the queue and returns it. More...


Private Attributes

priority_queue<Jobq_Jobqueue
 jobs queued for the working threads.

Mutex_ Qmutex
 controls access to the queue.

Condvar_ Todo
 to alert working threads to do some job.


Detailed Description

Class MTqueue_: this class sets up a priority queue that pipes "jobs" to a set of working threads.

The jobs must be independent of each other.

Definition at line 112 of file MTqueue.hh.


Constructor & Destructor Documentation

RazorBack::MTqueue_::MTqueue_ ( ) [inline]
 

Init to empty.

Definition at line 153 of file MTqueue.hh.


Member Function Documentation

template<class Fwditer_>
void RazorBack::MTqueue_::submit_jobs ( Fwditer_ First,
Fwditer_ Last )
 

submit_jobs(First, Last): pushes a range of job objects between the iterators First and Last onto the priority queue and waits until all jobs have been completed by the working threads.

The job objects may be stored in any STL sequence, vectors and lists are good choices. It is assumed that the objects in the sequence between First and Last are of a type derived from MTjobbase_.

void RazorBack::MTqueue_::wait_4job ( ) const [inline]
 

wait_4job(): this is to be used by the working threads to wait until someone pushes a job onto the queue.

Definition at line 172 of file MTqueue.hh.

MTqueue_::Jobq_ RazorBack::MTqueue_::pop_job ( )
 

pop_job(): takes a job object wrapper from the priority queue, removes it from the queue and returns it.

If the queue was empty then an empty wrapper is returned.


Member Data Documentation

priority_queue< Jobq_ > RazorBack::MTqueue_::Jobqueue<Jobq_> [private]
 

jobs queued for the working threads.

Definition at line 145 of file MTqueue.hh.

Mutex_ RazorBack::MTqueue_::Qmutex [mutable, private]
 

controls access to the queue.

Definition at line 146 of file MTqueue.hh.

Condvar_ RazorBack::MTqueue_::Todo [mutable, private]
 

to alert working threads to do some job.

Definition at line 147 of file MTqueue.hh.


The documentation for this class was generated from the following file:
Generated at Wed Aug 21 09:33:35 2002 for The Razorback C++ Library: POSIX Thread Wrappers by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001