SCM Library
Spherical Cube Map rendering library
|
An scm_queue implements a templated producer-consumer priority queue. More...
#include <scm-queue.hpp>
Public Member Functions | |
scm_queue (int n) | |
Create a new queue with n slots. Initialize counting semaphores for full slots and empty slots, plus a mutex to protect the data. | |
~scm_queue () | |
Finalize a queue and release its mutex and semaphores. | |
bool | try_insert (T &) |
Non-blocking enqueue for use by the render thread. | |
bool | try_remove (T &) |
Non-blocking dequeue for use by the render thread. | |
void | insert (T) |
Blocking enqueue for use by the loader threads. | |
T | remove () |
Blocking dequeue for use by the loader threads. | |
An scm_queue implements a templated producer-consumer priority queue.
Priority is given by the partial ordering on the templated type.
A "needs" queue is used by the render thread to delegate work to a set of loader threads. A "loads" queue is used by the loader threads to return their results to the render thread. In all cases, the loader threads perform blocking operations while the render thread uses non-blocking operations to ensure that frames are not dropped due to data latency.