global-functions: $ScriptLock: check for successful removal of ticket

The script is already locked, so there is no second script to remove a
ticket at the same time. However a new script can add a new ticket and
overwrite the removal... Thus check for successful removal anyway.
This commit is contained in:
Christian Hesse 2021-07-25 23:08:23 +02:00
parent 8e2c783068
commit 4269bc9548
1 changed files with 9 additions and 5 deletions

View File

@ -946,13 +946,17 @@
:global ScriptLockOrder;
:local New [ :toarray "" ];
:foreach Ticket in=($ScriptLockOrder->$Script) do={
:if ($Ticket != $Remove) do={
:set New ($New, $Ticket);
:while (true) do={
:local New [ :toarray "" ];
:foreach Ticket in=($ScriptLockOrder->$Script) do={
:if ($Ticket != $Remove) do={
:set New ($New, $Ticket);
}
}
:set ($ScriptLockOrder->$Script) $New;
:delay 12ms;
:if (($ScriptLockOrder->$Script->0) != $Remove) do={ :return true; }
}
:set ($ScriptLockOrder->$Script) $New;
}
:if ([ :len [ / system script find where name=$Script ] ] = 0) do={