ID : 5160
TakeMutex
Function
To change the Mutex object's status from "Unlocked" to "Locked." If the designated Mutex object's status is not "Unlocked", wait for the execution.
Syntax
TakeMutex MutexID[, Timeout]
Guaranteed entry
- MutexID
- Designate the ID of Mutex object by integer type data.
- Timeout
- Designate a timeout period by integer type data. The unit is [ms]. This is an optional value. When omitted, it is -1 (Infinite waiting).
Description
Change the Mutex object's status from "Unlocked" to "Locked."
When designating Timeout, wait for acquisition of the authorization for the designated period. If you cannot acquire the authorization beyond the designated period, error will occur.
Related Terms
Mutex Object, CreateMutex, DeleteMutex, TakeMutex, GiveMutex, ResetMutex, MutexID, MutexState, Program Example 1 for Exclusion Control, Program Example 2 for Exclusion Control, Program Example 3 for Exclusion Control
Attention
Example
Sub Main
Dim n As Integer
n = CreateMutex(S[10])
TakeMutex n
' Statements
GiveMutex n
DeleteMutex n
End Sub
ID : 5160