Make use of recursive mutex

This commit is contained in:
Tristan B. Velloza Kildaire 2022-01-16 12:57:05 +02:00
parent f532b1ef8b
commit 71e3476afd
1 changed files with 7 additions and 5 deletions

View File

@ -106,22 +106,24 @@ public abstract class Descriptor
/**
* TODO: Add comment
*
* This method is not thread safe, it is only to
* be called from thread safe functions that
* correctly lock the queue
* Returns true if the given descriptor ID is in
* use, false otherwise
*/
private static bool isDescIDInUse(string descID)
{
descQueueLock.lock();
foreach(string descIDCurr; descQueue)
{
if(cmp(descID, descIDCurr) == 0)
{
descQueueLock.unlock();
return true;
}
}
descQueueLock.unlock();
return false;
}