aboutsummaryrefslogtreecommitdiffstats
path: root/router/router.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-06-29 10:39:27 -0700
committerChris Robinson <[email protected]>2017-06-29 10:39:27 -0700
commit058d57ef0352ee0f46fc5e0ebe76479660bfc44e (patch)
treefbae1802299c979047e4fcf2ef2ccc3790e7b1f5 /router/router.c
parente8ce8924d179d515fe1439163b7ea73e895f408c (diff)
Protect device enumeration in the router with a mutex
Diffstat (limited to 'router/router.c')
-rw-r--r--router/router.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/router/router.c b/router/router.c
index 86189b78..4dfae314 100644
--- a/router/router.c
+++ b/router/router.c
@@ -15,6 +15,8 @@ DriverIface *DriverList = NULL;
int DriverListSize = 0;
static int DriverListSizeMax = 0;
+almtx_t EnumerationLock;
+
static void LoadDriverList(void);
@@ -26,6 +28,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser
{
case DLL_PROCESS_ATTACH:
LoadDriverList();
+ almtx_init(&EnumerationLock, almtx_recursive);
break;
case DLL_THREAD_ATTACH:
@@ -34,6 +37,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser
case DLL_PROCESS_DETACH:
ReleaseALC();
+ almtx_destroy(&EnumerationLock);
for(i = 0;i < DriverListSize;i++)
{
if(DriverList[i].Module)