#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.
| typedef std::list<Dgram*> osg::DgramQueue::QueueT |
Definition at line 65 of file OSGDgramQueue.h.
| DgramQueue::DgramQueue | ( | ) |
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 }
| DgramQueue::~DgramQueue | ( | ) | [virtual] |
| osg::DgramQueue::DgramQueue | ( | const DgramQueue & | source | ) | [private] |
| void DgramQueue::put | ( | Dgram * | dgram | ) |
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 }
| bool DgramQueue::empty | ( | void | ) |
put a dgram to the queue.
Definition at line 138 of file OSGDgramQueue.cpp.
References _queue.
Referenced by osg::PointMCastConnection::readBuffer(), osg::PointMCastConnection::selectChannel(), osg::GroupMCastConnection::sendQueue(), osg::GroupMCastConnection::~GroupMCastConnection(), and osg::PointMCastConnection::~PointMCastConnection().
00139 { 00140 return _queue.empty(); 00141 }
| void DgramQueue::wait | ( | Lock * | lock | ) |
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().
Referenced by osg::PointMCastConnection::selectChannel().
00121 { 00122 if(_queue.empty()) 00123 { 00124 _waiting = true; 00125 lock->release(); 00126 _barrier->enter(2); 00127 lock->aquire(); 00128 } 00129 }
| bool DgramQueue::waiting | ( | void | ) |
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 }
| void osg::DgramQueue::operator= | ( | const DgramQueue & | source | ) | [private] |
Barrier* osg::DgramQueue::_barrier [protected] |
Definition at line 99 of file OSGDgramQueue.h.
Referenced by DgramQueue(), get(), put(), and wait().
QueueT osg::DgramQueue::_queue [protected] |
bool osg::DgramQueue::_waiting [protected] |
1.5.5