JeVois  1.22
JeVois Smart Embedded Machine Vision Toolkit
Share this page:
Loading...
Searching...
No Matches
jevois::Semaphore< BB > Class Template Reference

#include <jevois/Types/Semaphore.H>

template<BlockingBehavior BB>
class jevois::Semaphore< BB >

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).

Template Parameters
BBdefines the blocking behavior and should be a value from jevois::BlockingBehavior

Definition at line 70 of file Semaphore.H.

Inheritance diagram for jevois::Semaphore< BB >:

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.
 

Constructor & Destructor Documentation

◆ Semaphore()

template<BlockingBehavior BB>
jevois::Semaphore< BB >::Semaphore ( size_t  n = 0)

Create a semaphore with n initial resources.

Member Function Documentation

◆ count()

template<BlockingBehavior BB>
size_t jevois::Semaphore< BB >::count ( ) const

Get the current count.

◆ decrement()

template<BlockingBehavior BB>
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.

◆ increment()

template<BlockingBehavior BB>
void jevois::Semaphore< BB >::increment ( size_t  n)

Release n resources to the semaphore.


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