casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
boost Namespace Reference

-*- C++ -*- More...


Detailed Description

-*- C++ -*-

 

Example

Code in the master thread:

   ThreadCoordinator threadCoordinator (nThreads);

Create nThread threads and pass them a pointer to the thread coordinator object. Then enter the work loop

   for (int i = 0; i < nBuffers; i++){

Provide access to the i-th buffer

     threadCoordinator->getToWork(& vb); // tell workers to hop to it!

blocks if workers still busy

    }

Code in each worker thread:

   while (True){

     VisBuffer * workingBuffer = threadCoordinator_p->waitForWork (this);
     if (workingBuffer == NULL)
       break;

     doSomeWork(workingBuffer);