mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
24 lines
693 B
Plaintext
24 lines
693 B
Plaintext
/**
|
|
* fn_lockMutex.sqf
|
|
* @Descr: Lock a mutex. If mutex exists and is locked, will wait until mutex becomes free, before locking it again.
|
|
* @Author: Glowbal
|
|
*
|
|
* @Arguments: [mutexName STRING]
|
|
* @Return: BOOL True if succesfullly locked.
|
|
* @PublicAPI: true
|
|
*/
|
|
|
|
private ["_mutexName","_initalStatus","_return"];
|
|
_mutexName = [_this, 0, "", [""]] call BIS_fnc_param;
|
|
|
|
_return = false;
|
|
if (_mutexName != "")then {
|
|
private["_mutexCombinedName"];
|
|
_mutexCombinedName = format["CSE_FRAMEWORK_MUTEX_%1",_mutexName];
|
|
if !(isnil _mutexCombinedName) then {
|
|
[_mutexName] call cse_fnc_waitForSingleMutex;
|
|
missionNamespace setvariable [_mutexCombinedName, 1];
|
|
_return = true;
|
|
};
|
|
};
|
|
_return |