Crashpad
Public Member Functions | List of all members
crashpad::Semaphore Class Reference

An anonymous in-process counting sempahore. More...

#include "util/synchronization/semaphore.h"

Public Member Functions

 Semaphore (int value)
 Initializes the semaphore. More...
 
void Wait ()
 Performs the wait (or “procure”) operation on the semaphore. More...
 
bool TimedWait (double seconds)
 Performs a timed wait (or “procure”) operation on the semaphore. More...
 
void Signal ()
 Performs the signal (or “post”) operation on the semaphore. More...
 

Detailed Description

An anonymous in-process counting sempahore.

Constructor & Destructor Documentation

§ Semaphore()

crashpad::Semaphore::Semaphore ( int  value)
explicit

Initializes the semaphore.

Parameters
[in]valueThe initial value of the semaphore.

If the semaphore cannot be created, execution is terminated.

Member Function Documentation

§ Signal()

void crashpad::Semaphore::Signal ( )

Performs the signal (or “post”) operation on the semaphore.

Atomically increments the value of the semaphore by 1. If the new value is 0, a caller blocked in Wait() will be awakened.

§ TimedWait()

bool crashpad::Semaphore::TimedWait ( double  seconds)

Performs a timed wait (or “procure”) operation on the semaphore.

Parameters
[in]secondsThe maximum number of seconds to wait for the operation to complete.
Returns
false if the wait timed out, true otherwise.

This method is simlar to Wait(), except that the amount of time that it blocks is limited.

§ Wait()

void crashpad::Semaphore::Wait ( )

Performs the wait (or “procure”) operation on the semaphore.

Atomically decrements the value of the semaphore by 1. If the new value is negative, this function blocks and will not return until the semaphore’s value is incremented to 0 by Signal().

See also
TimedWait()

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