1
0
mirror of https://github.com/deavminet/dnetd synced 2024-09-21 17:53:39 +02:00

Added mutex to getProperties

This commit is contained in:
Tristan B. Kildaire 2020-10-20 10:01:13 +02:00
parent 8a7480e356
commit 1694634e3c

View File

@ -948,8 +948,20 @@ public class DConnection : Thread
*/ */
public string getProperty(string propertyName) public string getProperty(string propertyName)
{ {
/* The fetched property */
string propertyValue;
/* Lock the properties store */
propertiesLock.lock();
/* Check for the property's existence */
propertyValue = properties[propertyName];
/* Unlock the properties store */
propertiesLock.unlock();
/* TODO: Error handling */ /* TODO: Error handling */
return properties[propertyName]; return propertyValue;
} }
/** /**
@ -957,7 +969,19 @@ public class DConnection : Thread
*/ */
public string[] getProperties() public string[] getProperties()
{ {
return properties.keys(); /* The list of keys */
string[] propertiesString;
/* Lock the properties store */
propertiesLock.lock();
/* Check for the property's existence */
propertiesString = properties.keys();
/* Unlock the properties store */
propertiesLock.unlock();
return propertiesString;
} }
/** /**