VEXcode Doxygen
Public Member Functions | List of all members
vex::semaphore Class Reference

Use this class to synchronize access to resources. More...

#include <vex_task.h>

Public Member Functions

void lock ()
 Attempts to lock the semaphore. If the semaphore is previously locked, it will block until the semaphore is unlocked. More...
 
void lock (uint32_t time)
 Attempts to lock the semaphore. If the semaphore is previously locked, it will block until the timeout has expired or the semaphore is unlocked. More...
 
void unlock ()
 Unlocks a locked semaphore. More...
 
bool owner ()
 Checks to see if the semaphore was locked and is owned by the current task. More...
 

Detailed Description

Use this class to synchronize access to resources.

@prog_lang{pro}

Member Function Documentation

◆ lock() [1/2]

void vex::semaphore::lock ( )

Attempts to lock the semaphore. If the semaphore is previously locked, it will block until the semaphore is unlocked.

@prog_lang{pro} @drawer_cat{none} @block_sig{Semaphore.lock();}

◆ lock() [2/2]

void vex::semaphore::lock ( uint32_t  time)

Attempts to lock the semaphore. If the semaphore is previously locked, it will block until the timeout has expired or the semaphore is unlocked.

@prog_lang{pro} @drawer_cat{none} @block_sig{Semaphore.lock(300);}

Parameters
timeThe maximum amount of time to wait for the semaphore to be unlocked in milliseconds.

◆ owner()

bool vex::semaphore::owner ( )

Checks to see if the semaphore was locked and is owned by the current task.

@prog_lang{pro} @drawer_cat{none} @block_sig{Semaphore.owner()}

Returns
Returns a true Boolean if the semaphore was locked and is owned by the current task.

◆ unlock()

void vex::semaphore::unlock ( )

Unlocks a locked semaphore.

@prog_lang{pro} @drawer_cat{none} @block_sig{Semaphore.unlock();}


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