public class NamedSemaphore : WaitHandle
Public Class NamedSemaphore
Inherits WaitHandle
public ref class NamedSemaphore : public WaitHandle
Gemstone.Threading.NamedSemaphore = function();
Type.createClass(
'Gemstone.Threading.NamedSemaphore',
WaitHandle);
A NamedSemaphore is a synchronization object that can be utilized across multiple processes.
On POSIX systems, the NamedSemaphore exhibits kernel persistence, meaning instances will remain active beyond the lifespan of the creating process. Named semaphores must be explicitly removed by invoking Unlink when they are no longer needed. Kernel persistence necessitates careful design consideration regarding the responsibility for invoking Unlink. Since the common use case for named semaphores is across multiple applications, it is advisable for the last exiting process to handle the cleanup. In cases where an application may crash before calling Unlink, the semaphore persists in the system, potentially leading to resource leakage. Implementations should include strategies to address and mitigate this risk.
NamedSemaphore(Int32, Int32, String) | Initializes a new instance of the NamedSemaphore class, specifying the initial number of entries, the maximum number of concurrent entries, and the name of a system semaphore object. |
NamedSemaphore(Int32, Int32, String, Boolean) | Initializes a new instance of the NamedSemaphore class, specifying the initial number of entries, the maximum number of concurrent entries, the name of a system semaphore object, and specifying a variable that receives a value indicating whether a new system semaphore was created. |
Handle | Gets or sets the native operating system handle. (Inherited from WaitHandle) Obsolete. |
Name | Gets the name of the NamedSemaphore. |
SafeWaitHandle | Gets or sets the native operating system handle. |
Close |
Releases all resources held by the current NamedSemaphore.
(Overrides WaitHandleClose) |
Dispose | Releases all resources used by the current instance of the WaitHandle class. (Inherited from WaitHandle) |
Dispose(Boolean) |
When overridden in a derived class, releases the unmanaged resources used by the NamedSemaphore,
and optionally releases the managed resources.
(Overrides WaitHandleDispose(Boolean)) |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object) |
GetHashCode | Serves as the default hash function. (Inherited from Object) |
GetLifetimeService | Retrieves the current lifetime service object that controls the lifetime policy for this instance. (Inherited from MarshalByRefObject) Obsolete. |
GetType | Gets the Type of the current instance. (Inherited from Object) |
InitializeLifetimeService | Obtains a lifetime service object to control the lifetime policy for this instance. (Inherited from MarshalByRefObject) Obsolete. |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object) |
MemberwiseClone(Boolean) | Creates a shallow copy of the current MarshalByRefObject object. (Inherited from MarshalByRefObject) |
OpenExisting | Opens an existing named semaphore. |
Release | Exits the semaphore and returns the previous count. |
Release(Int32) | Exits the semaphore a specified number of times and returns the previous count. |
ToString | Returns a string that represents the current object. (Inherited from Object) |
TryOpenExisting | Opens the specified named semaphore, if it already exists, and returns a value that indicates whether the operation succeeded. |
Unlink | Removes a named semaphore. |
Unlink(String) | Removes a named semaphore. |
WaitOne |
Blocks the current thread until the current NamedSemaphore receives a signal.
(Overrides WaitHandleWaitOne) |
WaitOne(Int32) |
Blocks the current thread until the current instance receives a signal, using a 32-bit signed integer to
specify the time interval in milliseconds.
(Overrides WaitHandleWaitOne(Int32)) |
WaitOne(TimeSpan) |
Blocks the current thread until the current instance receives a signal, using a TimeSpan
to specify the time interval.
(Overrides WaitHandleWaitOne(TimeSpan)) |
WaitOne(Int32, Boolean) |
Blocks the current thread until the current NamedSemaphore receives a signal, using a
32-bit signed integer to specify the time interval and specifying whether to exit the synchronization
domain before the wait.
(Overrides WaitHandleWaitOne(Int32, Boolean)) |
WaitOne(TimeSpan, Boolean) |
Blocks the current thread until the current instance receives a signal, using a TimeSpan
to specify the time interval and specifying whether to exit the synchronization domain before the wait.
(Overrides WaitHandleWaitOne(TimeSpan, Boolean)) |
GetEnumValueOrDefault |
Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |
GetEnumValueOrDefaultT |
Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions) |