SCM Library
Spherical Cube Map rendering library
 All Classes Files Functions Variables Friends Pages
Public Member Functions | List of all members
scm_queue< T > Class Template Reference

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.
 

Detailed Description

template<typename T>
class scm_queue< T >

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.

See Also
scm_file
scm_cache

The documentation for this class was generated from the following file: