S3FC project page | S3FC home page |
sem_t
(implemented in LinuxThreads).
More...
#include <s3_semaphore.h>
Public Methods | |
s3_semaphore (int n_value=0) | |
Default and initialising constructor: instantiate a new semaphore, initialising it with the supplied value. More... | |
~s3_semaphore () | |
Destructor: destroy the semaphore primitive. More... | |
void | wait () const |
Suspend the caller until the semaphore has a non-zero value. More... | |
bool | try_wait () const |
A non-blocking version of wait() . More... | |
void | post () const |
Increment the value of the semaphore by one. More... | |
int | get_value () const |
Return the current value of the semaphore. More... | |
void | flush () const |
Ensure that the current value is zero. More... | |
Protected Attributes | |
sem_t | sem |
LinuxThreads semaphore primitive. More... | |
Private Methods | |
s3_semaphore (const s3_semaphore &src) | |
Copy constructor: private for your convenience (thou shalt not copy construct an s3_semaphore - deal with it). More... | |
s3_semaphore & | operator= (const s3_semaphore &src) |
Neither shalt thou copy assign an s3_semaphore . More... |
sem_t
(implemented in LinuxThreads).
A semaphore has a positive integer value associated with it and supports the following operations:
All the member functions are declared const and a semaphore can therefore always be used in a const
context.
Definition at line 68 of file s3_semaphore.h.
|
Default and initialising constructor: instantiate a new semaphore, initialising it with the supplied value. Initialise with a value of zero (0) when used as a default constructor. Note: The semaphore is initialised as local (i.e. not shared) as this is the only implementation currently supported by LinuxThreads.
Definition at line 42 of file s3_semaphore.cc. References sem. |
|
Destructor: destroy the semaphore primitive.
Definition at line 52 of file s3_semaphore.cc. References sem. |
|
Copy constructor: private for your convenience (thou shalt not copy construct an
Definition at line 63 of file s3_semaphore.cc. |
|
Ensure that the current value is zero.
This is done by calling Definition at line 139 of file s3_semaphore.cc. References try_wait. |
|
Return the current value of the semaphore.
Definition at line 101 of file s3_semaphore.cc. References CONST_OVERRIDE_SEM_T, and sem. |
|
Neither shalt thou copy assign an
Definition at line 70 of file s3_semaphore.cc. |
|
Increment the value of the semaphore by one.
If the increment operation would cause the semaphore value to exceed Definition at line 90 of file s3_semaphore.cc. References CONST_OVERRIDE_SEM_T, and sem. Referenced by s3_rpc_server::main_loop, s3_post_office_switch::main_loop, s3_post_office::main_loop, s3_txport_tcp_rx_task::set_terminate, s3_txport_tcp_tx_task< s3_message, s3_socket_tcp >::set_terminate, s3_txport_tcp< s3_message >::set_terminate, s3_thread_base::signal_state_changed, and s3_txport_local::~s3_txport_local. |
|
A non-blocking version of
If the value of the semaphore is zero, return a
Definition at line 83 of file s3_semaphore.cc. References CONST_OVERRIDE_SEM_T, and sem. Referenced by flush, s3_txport_tcp::main_loop, s3_txport_tcp_rx_task::main_loop, s3_txport_tcp_tx_task::main_loop, s3_txport_local::main_loop, s3_socket_tcp_ssl::read, s3_socket_tcp::read, s3_socket_tcp_ssl::write, and s3_socket_tcp::write. |
|
Suspend the caller until the semaphore has a non-zero value. If the semaphore obtains a non-zero value (either at the start of the call or while waiting on it), it is decremented and the call returns. Definition at line 77 of file s3_semaphore.cc. References CONST_OVERRIDE_SEM_T, and sem. Referenced by s3_post_office::connect, s3_txport_tcp_rx_task::main_loop, s3_txport_tcp_tx_task::main_loop, s3_txport_local::main_loop, s3_post_office_switch::main_loop, s3_post_office::main_loop, s3_post_office_switch::s3_post_office_switch, s3_rpc_server::s3_rpc_server, and s3_thread_base::wait_on_state_changed. |
|
LinuxThreads semaphore primitive.
Definition at line 74 of file s3_semaphore.h. Referenced by get_value, post, s3_semaphore, try_wait, wait, and ~s3_semaphore. |
Send comments to: s3fc@stonethree.com |
|