|
<< Click to Display Table of Contents >> Navigation: ThinBASIC Tools > thinBundle > #BUNDLE MUTEX |
Description
Instruct BUNDLE process to check and create a MUTEX when bundled exe is executed.
Syntax
#BUNDLE MUTEX "UniqueMutexName" [, "MessageTextToShow" ]
Returns
If MUTEX cannot be created, process will return 32011 error code.
If "MessageTextToShow" is specified, user will get a message box with the specified message
Parameters
Remarks
A Mutex is a synchronization objects. Its basic purpose is to provide a synchronization method. For example if you want to be sure that a script is executed just once, try to create a mutex with a unique name. If you cannot create a mutex with that name (return value is zero), it can mean the same script is already running in your system so stop current one. If instead you can create a mutex, it means the same script is not running.
Restrictions
This directive is a pre parsing directive.
It means all #BUNDLE ... statements will be solved before starting script execution.
See also
Examples
'---Create a MUTEX per applicatio/user. The same application cannot be executed twice by the same active and logged in user
'---If it happen, process will return error code 32011 and the message is showed
#bundle mutex "{username}\MyApp", "MyApp is already running for user {username}. No other session allowed"
'---Create a MUTEX per applicatio/user. The same application cannot be executed twice by the same active and logged in user
'---If it happen, process will return error code 32011 and the message is showed
#bundle mutex "{username}\MyApp"