class RTT::base::DataObjectLockFree< T >
This DataObject is a Lock-Free implementation, such that reads and writes can happen concurrently without priority inversions.
When there are more writes than reads, the last write will be returned. The internal buffer can get full if too many concurrent reads are taking to long. In that case, each new read will read the element the previous read returned.
* The following Truth table applies when a Low Priority thread is
* preempted by a High Priority thread :
* L\H | Set | Get |
* Set | Ok | Ok |
* Get | Ok | Ok |
* legend : L : Low Priority thread
* H : High Priority thread
* Blk: Blocks High Priority thread (bad!)
* internal::NA : Not allowed !
Further, multiple reads may occur before, during and after a write operation simultaneously. The buffer needs readers+2*writers elements to be guaranteed non blocking.
Definition at line 77 of file DataObjectLockFree.hpp.
Set the data to a certain value (non blocking).
|push||The data which must be set. |
This method can not be called concurrently (only one producer). With a minimum of 3 buffers, if the write_ptr+1 field is not occupied, it will remain so because the read_ptr is at write_ptr-1 (and can not increment the counter on write_ptr+1). Hence, no locking is needed.
Implements RTT::base::DataObjectInterface< T >.
Definition at line 191 of file DataObjectLockFree.hpp.