A thread specific resource that uses double buffering to avoid multithreaded synchronization mechanisms. More...
#include <doublebufferedresource.h>
Public Member Functions | |
DoubleBufferedResource () | |
A Constructor that creates default versions of the resources. More... | |
DoubleBufferedResource (T *Current, T *Buffer) | |
A constructor that takes ownership of the the resources passed. More... | |
~DoubleBufferedResource () | |
Destructor, this deletes both the resources managed. Regardless of how it got a hold of the pointers. | |
T & | GetCommittable () |
Get a reference to the resource that can be committed. More... | |
T * | GetCommittablePointer () const |
Get a pointer to the resource that can be committed. More... | |
T & | GetUsable () |
Get a reference to the resource that can be used. More... | |
T * | GetUsablePointer () const |
Get a pointer to the resource that can be used. More... | |
void | SwapUsableAndCommitable () |
Make the buffered resource the active and vice versa. | |
A thread specific resource that uses double buffering to avoid multithreaded synchronization mechanisms.
It is intended for a Mezzanine::Threading::iWorkUnit "iWorkUnit" like the to provide asynchronous access to resources that to not need immediate atomicity. For example, it is ok if logs are gathered asynchronously and aggregated later as long no log messages are damaged, lost or taken out of order. This allows IO and other potentially expensive tasks to be used without blocking the current thread.
Definition at line 70 of file doublebufferedresource.h.
|
inline |
A Constructor that creates default versions of the resources.
This calls the default constructors for type T.
Definition at line 82 of file doublebufferedresource.h.
|
inline |
A constructor that takes ownership of the the resources passed.
Current | This will be used as the first resource for threads to use. |
Buffer | This will wait for the other thread |
Definition at line 101 of file doublebufferedresource.h.
|
inline |
Get a reference to the resource that can be committed.
Definition at line 125 of file doublebufferedresource.h.
|
inline |
Get a pointer to the resource that can be committed.
Definition at line 115 of file doublebufferedresource.h.
|
inline |
Get a reference to the resource that can be used.
Definition at line 120 of file doublebufferedresource.h.
|
inline |
Get a pointer to the resource that can be used.
Definition at line 110 of file doublebufferedresource.h.