Skip to content

Commit

Permalink
fix(agdi): create link mutex when dll init
Browse files Browse the repository at this point in the history
PDSC applications do not follow the `InitDLL()` function flow, so we
initialize the required mutex in advance.
  • Loading branch information
windowsair committed Aug 13, 2024
1 parent 0d643d0 commit 057fcd1
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions elaphureLinkAGDI/DbgCM/DbgCM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ BOOL CDbgCMApp::InitInstance()
return FALSE;
}

CreateLinkCom();

CWinApp::InitInstance();

return TRUE;
Expand Down Expand Up @@ -831,8 +833,11 @@ HANDLE kDebugAccessMutex = 0;
static int CreateLinkCom()
{
// Create mutex (buf holds unique name for the USB device)
LinkMutex = CreateMutex(NULL, FALSE, EL_MUTEX_AGDI_LINK_COM_NAME);
kDebugAccessMutex = CreateMutex(NULL, FALSE, EL_MUTEX_AGDI_DEBUG_ACCESS_NAME);
if (!LinkMutex)
LinkMutex = CreateMutex(NULL, FALSE, EL_MUTEX_AGDI_LINK_COM_NAME);

if (!kDebugAccessMutex)
kDebugAccessMutex = CreateMutex(NULL, FALSE, EL_MUTEX_AGDI_DEBUG_ACCESS_NAME);

return 0;
}
Expand Down

0 comments on commit 057fcd1

Please sign in to comment.