OpenVideo Documentation

   Main Page       Modules       Class Hierarchy       Alphabetical List       Compound List       File List       Compound Members       Related Pages   

openvideo::BufferSynchronizer Class Reference

Makes sure that a client can get a locked buffer in one thread without overwriting that buffer variable from another thread. More...

#include <State.h>

List of all members.

Public Member Functions

 BufferSynchronizer ()
 ~BufferSynchronizer ()
void assign (Buffer *newBuffer)
BuffergetLocked ()

Protected Attributes

Bufferbuffer
ACE_Thread_Mutex * mutex


Detailed Description

Makes sure that a client can get a locked buffer in one thread without overwriting that buffer variable from another thread.

Definition at line 201 of file State.h.


Constructor & Destructor Documentation

openvideo::BufferSynchronizer::BufferSynchronizer  ) 
 

Definition at line 109 of file State.cxx.

References buffer, and mutex.

openvideo::BufferSynchronizer::~BufferSynchronizer  ) 
 

Definition at line 116 of file State.cxx.

References buffer, mutex, and openvideo::Buffer::unlock().


Member Function Documentation

void openvideo::BufferSynchronizer::assign Buffer newBuffer  ) 
 

This methods synchronizes the assignment with the getLocked() operation and thereby makes sure that a client can always get a valid, locked buffer object.

Definition at line 128 of file State.cxx.

References buffer, openvideo::Buffer::lock(), mutex, and openvideo::Buffer::unlock().

Referenced by openvideo::GLUTSink::process().

Buffer * openvideo::BufferSynchronizer::getLocked  ) 
 

The calling instance is responsible for unlocking the buffer as soon as it is no longer used.

Note: testing for NULL is suggested since getLocked() might return NULL, if no buffer of NULL was assigned!

Definition at line 147 of file State.cxx.

References buffer, openvideo::Buffer::lock(), and mutex.

Referenced by openvideo::GLUTSink::updateTexture().


Member Data Documentation

Buffer* openvideo::BufferSynchronizer::buffer [protected]
 

Definition at line 224 of file State.h.

Referenced by assign(), BufferSynchronizer(), getLocked(), and ~BufferSynchronizer().

ACE_Thread_Mutex* openvideo::BufferSynchronizer::mutex [protected]
 

Definition at line 225 of file State.h.

Referenced by assign(), BufferSynchronizer(), getLocked(), and ~BufferSynchronizer().


The documentation for this class was generated from the following files:
 This page was generated at Wed May 31 13:04:19 2006 for OpenVideo by Doxygen.
 If you have any comments, please send a message to schmalstieg@icg.tu-graz.ac.at.
www.studierstube.org