Cyg_Counting_Semaphore::Cyg_Counting_Semaphore | |
Name: | Cyg_Counting_Semaphore::Cyg_Counting_Semaphore ( ) - create counting semaphore |
---|---|
Synopsis: | Cyg_Counting_Semaphore::Cyg_Counting_Semaphore ( cyg_count32 init_count = 0 /* inital count */ ) |
Description: | This creates a counting semaphore. |
Include: | #include <cyg/kernel/sema.hxx> |
Returns: | nothing |
See Also: | Cyg_Counting_Semaphore::~Cyg_Counting_Semaphore |
Cyg_Counting_Semaphore::~Cyg_Counting_Semaphore | |
Name: | Cyg_Counting_Semaphore::~Cyg_Counting_Semaphore ( ) - destroy a counting semaphore |
---|---|
Synopsis: | Cyg_Counting_Semaphore::~Cyg_Counting_Semaphore ( void ) |
Description: | This destroys a counting semaphore. This will NOT release threads waiting on the counting semaphore, it will simply call the destructor which essentially does nothing but free the memory. Be certain that not threads are waiting on this semaphore before destroying. |
Include: | #include <cyg/kernel/sema.hxx> |
Returns: | nothing |
See Also: | Cyg_Counting_Semaphore::Cyg_Counting_Semaphore |
Cyg_Counting_Semaphore::wait | |
Name: | Cyg_Counting_Semaphore::wait ( ) - get a counting semaphore |
---|---|
Synopsis: | cyg_bool Cyg_Counting_Semaphore::wait ( void ) |
Description: | Takes a counting semaphore. If the counting semaphore is not available this will block until the counting semaphore is available. |
Include: | #include <cyg/kernel/sema.hxx> |
Returns: | "true" is the counting semaphore was taken, "false" if the counting semaphore could not be taken. The value of "false" will be returned if the thread is awaken. See the thread api. |
See Also: | Cyg_Counting_Semaphore::trywait, Cyg_Counting_Semaphore::post, Cyg_Counting_Semaphore::peek |
Cyg_Counting_Semaphore::wait | |
Name: | Cyg_Counting_Semaphore::wait ( ) - wait until an absolute time for a counting semaphore |
---|---|
Synopsis: | cyg_bool Cyg_Counting_Semaphore::wait ( cyg_tick_count timeout /* absolute timeout */ ) |
Description: | This grabs a counting semaphore. If the semaphore is not available it will block the allocating thread until "timeout". Timeout is an absolute value, not a relative value. It's a 64 value. You can get the value of the real time clock with Cyg_Clock::real_time_clock->current_value(). |
Include: | #include <cyg/kernel/sema.hxx> |
Returns: | "true" if the semaphore was allocated, "false" is the thread was awaken for another reason. The value of "false" will be returned if the thread is awaken. See the thread api. |
See Also: | Cyg_Counting_Semaphore::trywait, Cyg_Counting_Semaphore::post, Cyg_Counting_Semaphore::peek |
Cyg_Counting_Semaphore::trywait | |
Name: | Cyg_Counting_Semaphore::trywait ( ) - get a counting semaphore, don't block |
---|---|
Synopsis: | cyg_bool Cyg_Counting_Semaphore::trywait ( void ) |
Description: | Takes a counting semaphore but only if it is currently available. If the counting semaphore has already been taken by another thread this will return "false". |
Include: | #include <cyg/kernel/sema.hxx> |
Returns: | "true" if the semaphore was taken "false" if it wasn't. |
See Also: | Cyg_Counting_Semaphore::wait, Cyg_Counting_Semaphore::post, Cyg_Counting_Semaphore::peek |
Cyg_Counting_Semaphore::post | |
Name: | Cyg_Counting_Semaphore::post ( ) - release a counting semaphore |
---|---|
Synopsis: | void Cyg_Counting_Semaphore::post ( void ) |
Description: | This will increment the count of a counting semaphore so it may be allocated by other threads. |
Include: | #include <cyg/kernel/sema.hxx> |
Returns: | nothing |
See Also: | Cyg_Counting_Semaphore::wait, Cyg_Counting_Semaphore::trywait, Cyg_Counting_Semaphore::peek |
Cyg_Counting_Semaphore::peek | |
Name: | Cyg_Counting_Semaphore::peek ( ) - get the count of a counting semaphore |
---|---|
Synopsis: | cyg_count32 Cyg_Counting_Semaphore::peek ( void ) |
Description: | This just gets the count of a counting semaphore. If any threads are waiting on the counting semaphore, this will of course return 0. |
Include: | #include <cyg/kernel/sema.hxx> |
Returns: | the count of the counting semaphore. |
See Also: | Cyg_Counting_Semaphore::wait, Cyg_Counting_Semaphore::trywait, Cyg_Counting_Semaphore::post |