Commands related to synchronization primitives
create_event ?options? |
create_mutex ?options? |
lock_mutex HANDLE ?-wait MILLISECS? |
open_mutex ?-access ACCESSRIGHTS? ?-inherit BOOLEAN? |
reset_event HANDLE |
set_event HANDLE |
unlock_mutex HANDLE |
This package provides procedures related to various syncrhonization primitives on Windows platforms.
A mutex is a synchronization object that can be used to coordinate mutually exclusive access to shared resources. Refer to the Windows SDK for details about capabilities and use.
Mutexes can be created using create_mutex. Existing mutexes can be accessed using open_mutex. The commands lock_mutex and unlock_mutex can be used to gain and release ownership of the shared resource.
An event is a synchronization object that can be in one of two states - signalled and non-signalled. It is useful for notifying a process or thread of the occurence of some event. Refer to the Windows SDK for details about usage.
Event objects can be created through create_event and their state changed using the commands set_event and reset_event. An application can wait on an event object to be signalled using the wait_on_handle command.
-existvar VARNAME | If specified, the command will set the variable VARNAME in the caller's context to 0 if the event was newly created and to 1 if the event already existed. |
-inherit BOOLEAN | If specified as true, the handle will be inherited by child processes (default false). |
-manualreset BOOLEAN | By default, events are automatically reset to a non-signalled state when a thread successfully waits on an event. If this option is specified as true, the event remains signalled until it is explicitly reset using the reset_event command. Default is false. |
-name NAME | Specifies the name of the event. Events are unnamed by default. |
-secd SECURITY_DESCRIPTOR | Specifies a security descriptor for the event object. By default, a null security descriptor is used. |
-signalled BOOLEAN | If specified as true the event object is created in a signalled state. Default is false. This option must not be specified as true if the option -name is also specified. |
-inherit BOOLEAN | If specified as true, the handle will be inherited by child processes (default false). |
-lock BOOLEAN | If specified as true the mutex is created in a locked state. Default is false. This option must not be specified as true if the option -name is also specified. |
-name NAME | Specifies the name of the event. Events are unnamed by default. |
-secd SECURITY_DESCRIPTOR | Specifies a security descriptor for the event object. By default, a null security descriptor is used. |
-access ACCESSRIGHTS | Specifies a list of desired access rights. If this option is not specified, access rights default to mutex_all_access. See Access Rights for a description of the format of this list and for a description of standard access rights. |
-inherit BOOLEAN | If specified as true, the handle will be inherited by child processes (default false). |
Copyright © 2010 Ashok P. Nadkarni