Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

Semaphore Class Reference
[synsoft.win32.synch]

List of all members.

Detailed Description

This class represents a Win32 semaphore synchronisation object.


Public Methods

Construction
 this (int maxSlots)
 Creates an anonymous semaphore with the indicated number of slots. All slots are available.

 this (int maxSlots, int availableSlots)
 Creates an anonymous semaphore with the indicated number of slots.

 this (char[] name, int maxSlots)
 Creates a named semaphore with the indicated number of slots. All slots are available.

 this (char[] name, int maxSlots, int availableSlots)
 Creates a named semaphore with the indicated number of slots.

 ~this ()
 Calls the close() method, ensuring that the semaphore is released to the operating system when the object is destroyed.

Methods
void Close ()
 Closes the semaphore object handle.

boolean Wait (uint timeout)
 Waits, for the specified period, for a slot on the semaphore to become available.

void Wait ()
 Waits forever for a slot on the semaphore to become available.

void Release (uint cSlots)
 Releases the given number of slots acquired on the semaphore.

void Release ()
 Releases one slot acquired on the semaphore.

Properties
int propget_NumSlots ()
 The maximum number of slots in the semaphore.

int propget_AvailableSlots ()
 The number of available slots in the semaphore.

char[] propget_Name ()
 The name of the semaphore.


Public Attributes

Constants
const uint INFINITE = (uint)0xFFFFFFFF
 Represents an infinite wait period.


Constructor & Destructor Documentation

~this   [inline]
 

Calls the close() method, ensuring that the semaphore is released to the operating system when the object is destroyed.


Member Function Documentation

void Close   [inline]
 

Closes the semaphore object handle.

int propget_AvailableSlots   [inline]
 

The number of available slots in the semaphore.

char [] propget_Name   [inline]
 

The name of the semaphore.

int propget_NumSlots   [inline]
 

The maximum number of slots in the semaphore.

void Release   [inline]
 

Releases one slot acquired on the semaphore.

Note:
A SynchException object is thrown if the release fails

void Release uint    cSlots [inline]
 

Releases the given number of slots acquired on the semaphore.

Parameters:
cSlots  The number of slots to release
Note:
A SynchException object is thrown if the release fails

this char    name[],
int    maxSlots,
int    availableSlots
[inline]
 

Creates a named semaphore with the indicated number of slots.

Parameters:
name  The name of the semaphore
maxSlots  The maximum number of slots
availableSlots  The number of slots initially available
Note:
If the semaphore cannot be created the method throws a SynchException object

this char    name[],
int    maxSlots
[inline]
 

Creates a named semaphore with the indicated number of slots. All slots are available.

Parameters:
name  The name of the semaphore
maxSlots  The maximum number of slots

this int    maxSlots,
int    availableSlots
[inline]
 

Creates an anonymous semaphore with the indicated number of slots.

Parameters:
maxSlots  The maximum number of slots
availableSlots  The number of slots initially available

this int    maxSlots [inline]
 

Creates an anonymous semaphore with the indicated number of slots. All slots are available.

Parameters:
maxSlots  The maximum number of slots

void Wait   [inline]
 

Waits forever for a slot on the semaphore to become available.

Note:
If the wait fails the method throws a SynchException object

boolean Wait uint    timeout [inline]
 

Waits, for the specified period, for a slot on the semaphore to become available.

Parameters:
timeout  The number of milliseconds to wait, or INFINITE for a non-expiring wait
Returns:
true if the semaphore slot was aquired, or false if the timeout period elapsed
Note:
If the wait fails the method throws a SynchException object


Member Data Documentation

const uint INFINITE = (uint)0xFFFFFFFF
 

Represents an infinite wait period.


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

D Libraries documentation © Synesis Software Pty Ltd, 2002-2003