#include <vpr/Sync/Barrier.h>
Collaboration diagram for vpr::BarrierSGI:

Public Member Functions | |
| BarrierSGI (int count) | |
| Initializes the barrier to synchronize count threads. | |
| ~BarrierSGI () | |
| int | wait (int numProcs) |
| Blocks the caller until all numProcs threads have called wait() and then allows all the caller threads to continue in parallel. | |
| int | wait () |
| void | addProcess () |
| Tells the barrier to increase the count of the number of threads to syncronize. | |
| void | removeProcess () |
| Tells the barrier to decrease the count of the number of threads to syncronize. | |
| void | setProcesses (int procs) |
Protected Member Functions | |
| void | operator= (const BarrierSGI &) |
| BarrierSGI (const BarrierSGI &) | |
Protected Attributes | |
| Mutex | mutex |
| int | syncCount |
| barrier_t * | theBarrier |
Static Protected Attributes | |
| static MemPoolSGI * | barrierPool |
| static int * | attachedCounter |
A barrier is a primitive that allows several processes to wait at a sync point. This is typedef'd to vpr::Barrier.
Definition at line 63 of file BarrierSGI.h.
| vpr::BarrierSGI::BarrierSGI | ( | int | count | ) | [inline] |
Initializes the barrier to synchronize count threads.
Definition at line 69 of file BarrierSGI.h.
References vpr::MemPoolSGI::allocate(), attachedCounter, barrierPool, vpr::MemPoolSGI::getArena(), and theBarrier.
00069 : syncCount(count) 00070 { 00071 if (barrierPool == NULL) 00072 { 00073 barrierPool = new MemPoolSGI(65536, 32, 00074 "/var/tmp/memBarrierPoolSGIXXXXXX"); 00075 attachedCounter = static_cast<int*>(barrierPool->allocate(sizeof(int))); 00076 *attachedCounter = 0; 00077 } 00078 *attachedCounter = *attachedCounter + 1; // Track how many mutexes are allocated 00079 //vprDEBUG << "BarrierSGI::BarrierSGI: attachedCounter: " << *attachedCounter << std::endl << vprDEBUG_FLUSH; 00080 00081 // ----- Allocate the mutex ----- // 00082 theBarrier = new_barrier(barrierPool->getArena()); 00083 }
| vpr::BarrierSGI::~BarrierSGI | ( | ) | [inline] |
Definition at line 85 of file BarrierSGI.h.
References attachedCounter, barrierPool, vpr::MemPoolSGI::deallocate(), and theBarrier.
00086 { 00087 // ---- Delete the barrier --- // 00088 free_barrier(theBarrier); 00089 00090 // ---- Deal with the pool --- // 00091 *attachedCounter = *attachedCounter - 1; // Track how many mutexes are allocated 00092 00093 //vprDEBUG << "BarrierSGI::~BarrierSGI: attachedCounter: " << *attachedCounter << std::endl << vprDEBUG_FLUSH; 00094 00095 if (*attachedCounter == 0) 00096 { 00097 barrierPool->deallocate(attachedCounter); 00098 attachedCounter = NULL; 00099 delete barrierPool; 00100 barrierPool = NULL; 00101 } 00102 }
| vpr::BarrierSGI::BarrierSGI | ( | const BarrierSGI & | ) | [inline, protected] |
| int vpr::BarrierSGI::wait | ( | int | numProcs | ) | [inline] |
Blocks the caller until all numProcs threads have called wait() and then allows all the caller threads to continue in parallel.
Definition at line 108 of file BarrierSGI.h.
| int vpr::BarrierSGI::wait | ( | ) | [inline] |
Definition at line 113 of file BarrierSGI.h.
References syncCount, and theBarrier.
00114 { 00115 barrier(theBarrier, syncCount); 00116 //init_barrier(theBarrier); // -- How do I reset the barrier -- // 00117 return 0; 00118 }
| void vpr::BarrierSGI::addProcess | ( | ) | [inline] |
| void vpr::BarrierSGI::removeProcess | ( | ) | [inline] |
| void vpr::BarrierSGI::setProcesses | ( | int | procs | ) | [inline] |
| void vpr::BarrierSGI::operator= | ( | const BarrierSGI & | ) | [inline, protected] |
Mutex vpr::BarrierSGI::mutex [protected] |
Definition at line 147 of file BarrierSGI.h.
Referenced by addProcess(), removeProcess(), and setProcesses().
int vpr::BarrierSGI::syncCount [protected] |
Definition at line 148 of file BarrierSGI.h.
Referenced by addProcess(), removeProcess(), setProcesses(), and wait().
barrier_t* vpr::BarrierSGI::theBarrier [protected] |
vpr::MemPoolSGI * vpr::BarrierSGI::barrierPool [static, protected] |
int * vpr::BarrierSGI::attachedCounter [static, protected] |
1.5.1