Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Creates a new mutex with given name.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
Mutex | 10.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example |
---|---|---|
Name | The name to use for the mutex. Name should be a simple text, but unique, so we recommend reverse domain notation. The name should not contain a slash. |
"test" |
Returns reference number or error.
Create a mutex
MBS( "Mutex.Create"; "com.monkeybreadsoftware.test" )
Create the mutex and use it:
# create a mutex
Set Variable [ $mutex ; Value: MBS( "Mutex.Create"; "de.monkeybreadsoftware.test" ) ]
# lock it
Set Variable [ $r ; Value: MBS( "Mutex.TryLock"; $Mutex ) ]
If [ $r = 1 ]
# do something
#
# finally unlock
Set Variable [ $r ; Value: MBS( "Mutex.Unlock"; $Mutex ) ]
End If
# free it mutex
Set Variable [ $r ; Value: MBS( "Mutex.Free"; $Mutex ) ]
Created 5th April 2020, last changed 5th March 2021
Feedback: Report problem or ask question.