JeVois
1.22
JeVois Smart Embedded Machine Vision Toolkit
|
|
#include <jevois/Types/Semaphore.H>
A simple semaphore.
A semaphore is a thread-safe mechanism to share resources between multiple threads of execution.
See this Wikipedia page for basic information: http://en.wikipedia.org/wiki/Semaphore_%28programming%29
This code is derived from the Neuromorphic Robotics Toolkit (NRT).
BB | defines the blocking behavior and should be a value from jevois::BlockingBehavior |
Definition at line 70 of file Semaphore.H.
Public Member Functions | |
Semaphore (size_t n=0) | |
Create a semaphore with n initial resources. | |
void | increment (size_t n) |
Release n resources to the semaphore. | |
void | decrement (size_t n) |
Remove n resources from the semaphore, blocking until they are available or throwing if they are not. | |
size_t | count () const |
Get the current count. | |
jevois::Semaphore< BB >::Semaphore | ( | size_t | n = 0 | ) |
Create a semaphore with n initial resources.
size_t jevois::Semaphore< BB >::count | ( | ) | const |
Get the current count.
void jevois::Semaphore< BB >::decrement | ( | size_t | n | ) |
Remove n resources from the semaphore, blocking until they are available or throwing if they are not.
void jevois::Semaphore< BB >::increment | ( | size_t | n | ) |
Release n resources to the semaphore.