golib  0.5
goSemaphore Class Reference

Semaphore class. More...

#include <gothread.h>

Public Member Functions

void dec ()
 
void inc ()
 

Protected Attributes

sem_t semaphore
 

Detailed Description

Semaphore class.

This class implements a semaphore. A semaphore represents a value that can be incremented and decremented. If the semaphore's value is 0 and decrement is called, the calling thread is blocked until the semaphore is > 0, then the value is decremented. Increments and decrements are atomic operations, i.e. they are thread-safe.

Author
Christian Gosch

Member Function Documentation

◆ dec()

void goSemaphore::dec ( )

Waits until semaphore is > 0, then decrements it atomically.

◆ inc()

void goSemaphore::inc ( )

Increments the semaphore atomically.


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