#include <OSGDgramQueue.h>
Public Types | |
| typedef std::list< Dgram * > | QueueT |
Public Member Functions | |
Constructors | |
| * | DgramQueue () |
Destructor | |
| *virtual | ~DgramQueue () |
data put,get | |
| *void | put (Dgram *dgram) |
| Dgram * | get (Lock *lock) |
| bool | empty (void) |
| void | wait (Lock *lock) |
| bool | waiting (void) |
Protected Attributes | |
member | |
| *Barrier * | _barrier |
| QueueT | _queue |
| bool | _waiting |
Private Member Functions | |
| DgramQueue (const DgramQueue &source) | |
| prohibit default function (move to 'public' if needed) | |
| void | operator= (const DgramQueue &source) |
Definition at line 60 of file OSGDgramQueue.h.
|
|
Definition at line 65 of file OSGDgramQueue.h. |
|
|
Constructor size must be 2^x Definition at line 67 of file OSGDgramQueue.cpp. References _barrier, and osg::Barrier::get(). 00067 : 00068 _queue(), 00069 _waiting(false) 00070 { 00071 char barrierName[256]; 00072 sprintf(barrierName,"DgramQueue%p",this); 00073 00074 // create barrier 00075 _barrier = Barrier::get(barrierName); 00076 }
|
|
|
Destructor Definition at line 80 of file OSGDgramQueue.cpp.
|
|
|
|
|
|
put a dgram to the queue. Definition at line 89 of file OSGDgramQueue.cpp. References _barrier, _queue, _waiting, and osg::Barrier::enter(). Referenced by osg::GroupMCastConnection::GroupMCastConnection(), osg::PointMCastConnection::PointMCastConnection(), osg::PointMCastConnection::read(), osg::PointMCastConnection::readBuffer(), osg::PointMCastConnection::recvQueue(), osg::GroupMCastConnection::sendQueue(), osg::GroupMCastConnection::write(), and osg::GroupMCastConnection::~GroupMCastConnection(). 00090 { 00091 _queue.push_back(dgram); 00092 if(_waiting) 00093 { 00094 _waiting = false; 00095 _barrier->enter(2); 00096 } 00097 }
|
|
|
get a dgram from the queue. Block if queue is empty Definition at line 101 of file OSGDgramQueue.cpp. References _barrier, _queue, _waiting, osg::Lock::aquire(), osg::Barrier::enter(), and osg::Lock::release(). Referenced by osg::PointMCastConnection::read(), osg::PointMCastConnection::readBuffer(), osg::PointMCastConnection::recvQueue(), osg::GroupMCastConnection::sendQueue(), osg::GroupMCastConnection::write(), osg::GroupMCastConnection::~GroupMCastConnection(), and osg::PointMCastConnection::~PointMCastConnection(). 00102 { 00103 Dgram *result; 00104 00105 if(_queue.empty()) 00106 { 00107 _waiting = true; 00108 lock->release(); 00109 _barrier->enter(2); 00110 lock->aquire(); 00111 } 00112 result = _queue.front(); 00113 _queue.pop_front(); 00114 00115 return result; 00116 }
|
|
|
put a dgram to the queue. Definition at line 138 of file OSGDgramQueue.cpp. References _queue. Referenced by osg::PointMCastConnection::readBuffer(), osg::GroupMCastConnection::sendQueue(), osg::GroupMCastConnection::~GroupMCastConnection(), and osg::PointMCastConnection::~PointMCastConnection(). 00139 { 00140 return _queue.empty(); 00141 }
|
|
|
wait for a dgram but dont read Definition at line 120 of file OSGDgramQueue.cpp. References _barrier, _queue, _waiting, osg::Lock::aquire(), osg::Barrier::enter(), and osg::Lock::release(). 00121 { 00122 if(_queue.empty()) 00123 { 00124 _waiting = true; 00125 lock->release(); 00126 _barrier->enter(2); 00127 lock->aquire(); 00128 } 00129 }
|
|
|
true, if reader is waiting Definition at line 133 of file OSGDgramQueue.cpp. References _waiting. Referenced by osg::GroupMCastConnection::write(). 00134 { 00135 return _waiting; 00136 }
|
|
|
|
|
|
Definition at line 99 of file OSGDgramQueue.h. Referenced by DgramQueue(), get(), put(), and wait(). |
|
|
Definition at line 100 of file OSGDgramQueue.h. |
|
|
Definition at line 101 of file OSGDgramQueue.h. |
1.4.3