Open CASCADE Technology
6.5.4
|
IPC Tools -Semaphores
The semaphores are used to facilitate shared resources.
This implementation provides a way to ensure mutual
exclusion using 'Lock' and 'Free' primitives.
The Lock is used to prevent access if it's not yet allowed.
The Free validates the semaphores and if possible, frees process
waiting for a common resource.
#include <OSD_Semaphore.hxx>
Public Member Functions | |
DEFINE_STANDARD_ALLOC | OSD_Semaphore () |
Allocate room for semaphore name. This is to be used with 'Open'. so the process is a client. | |
OSD_Semaphore (const TCollection_AsciiString &Name) | |
Instantiates Semaphore object with a name. The name is the only way provided to work with a common semaphore for different processes. Each process working with the same semaphore must use a common known access : the semaphore's NAME. Raises ConstructionError when the name contains characters not in range of ' '...'~'. This is for a server process. | |
void | Build () |
Sets semaphore (physically) into memory | |
void | Open (const TCollection_AsciiString &Name) |
Opens (physically) a semaphore Raises ConstructionError when the name contains characters not in range of ' '...'~'. | |
Standard_Integer | GetCounter () |
Returns current value of the semaphore's counter. Raises ProgramError when the semaphore is not open. | |
void | SetCounter (const Standard_Integer Value) |
Sets the semaphore's counter to a specific value. Raises ProgramError when the semaphore is not open. | |
void | Delete () |
Removes the semaphore. This is used only by server process ! Raise ProgramError if the semaphore is already deleted. | |
void | Lock () |
Makes current process waiting for access Raises ProgramError when the semaphore does't exist. | |
void | Free () |
Frees one access to a semaphore. Raises ProgramError when the semaphore does't exist. | |
void | Restore () |
Resets semaphore counter to zero. Raises ProgramError when the semaphore does't exist. | |
Standard_Boolean | Failed () const |
Returns TRUE if an error occurs | |
void | Reset () |
Resets error counter to zero | |
void | Perror () |
Raises OSD_Error | |
Standard_Integer | Error () const |
Returns error number if 'Failed' is TRUE. |
Standard_Integer OSD_Semaphore::Error | ( | ) | const |
Standard_Boolean OSD_Semaphore::Failed | ( | ) | const |
void OSD_Semaphore::Open | ( | const TCollection_AsciiString & | Name | ) |