Documentation
¶
Index ¶
- Constants
- func CreateMutex(name string, initialOwner bool, attrs *syscall.SecurityAttributes) (h syscall.Handle, openedExisting bool, err error)
- func CreateMutexEx(name string, attrs *syscall.SecurityAttributes) (h syscall.Handle, openedExisting bool, err error)
- func OpenMutex(name string) (syscall.Handle, error)
- func ReleaseMutex(h syscall.Handle) (released bool, err error)
Constants ¶
const ( WaitAbandoned = 0x00000080 // WAIT_ABANDONED WaitTimeout = 0x00000102 // WAIT_TIMEOUT )
Special return values for syscall.WaitForSingleObject().
Variables ¶
This section is empty.
Functions ¶
func CreateMutex ¶
func CreateMutex(name string, initialOwner bool, attrs *syscall.SecurityAttributes) (h syscall.Handle, openedExisting bool, err error)
CreateMutex attempts to create a Windows mutex with the given name and attributes. If name is empty, it will created an unnamed mutex.
When creating a named mutex, if a mutex with the given name already exists, openedExisting will be true and a handle for the existing mutex will be returned.
If initial ownership is requested and the mutex does not already exist, it will be created in locked (signaled) state. If the named mutex exists already, a handle to the existing mutex is returned but it will not be be locked.
When successful, a handle to the mutex is returned. The handle is bound to the calling thread. This means that the caller should call runtime.LockOSThread() before calling this function. If any calls to a wait function or to ReleaseMutex are made with this handle, they must be made from the same thread.
https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createmutexw
func CreateMutexEx ¶
func CreateMutexEx(name string, attrs *syscall.SecurityAttributes) (h syscall.Handle, openedExisting bool, err error)
CreateMutexEx attempts to create a Windows mutex with the given name and attributes. If name is empty, it will created an unnamed mutex.
When creating a named mutex, if a mutex with the given name already exists, openedExisting will be true and a handle for the existing mutex will be returned.
When successful, a handle to the mutex is returned. The handle is bound to the calling thread. This means that the caller should call runtime.LockOSThread() before calling this function. If any calls to a wait function or to ReleaseMutex are made with this handle, they must be made from the same thread.
TODO: Add support for flags and desired access settings.
https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-createmutexexw
func OpenMutex ¶
OpenMutex attempts to open an existing Windows mutex with the given name and attributes. If the named mutex does not already exist, it returns a non-nil error.
When successful, a handle to the mutex is returned. The handle is bound to the calling thread. This means that the caller should call runtime.LockOSThread() before calling this function. If any calls to a wait function or to ReleaseMutex are made with this handle, they must be made from the same thread.
TODO: Accept the desired access rights as a parameter.
https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-openmutexw
func ReleaseMutex ¶
ReleaseMutex attempts to release the Windows mutex with the given handle.
https://learn.microsoft.com/en-us/windows/win32/api/synchapi/nf-synchapi-releasemutex
Types ¶
This section is empty.