From 833124c29759a551d5569a0ab122744b5e4436de Mon Sep 17 00:00:00 2001 From: Darryl Pogue Date: Sat, 10 Mar 2012 20:33:26 -0800 Subject: [PATCH] Get rid of CCritSect in the patcher stuff. --- Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp | 6 +++--- Sources/Plasma/Apps/plUruLauncher/Main.cpp | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp b/Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp index b8beaf9b..c36cde8d 100644 --- a/Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp +++ b/Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp @@ -113,7 +113,7 @@ struct ManifestResult { long * indicator; plLauncherInfo * info; - CCritSect critsect; + hsMutex critsect; ARRAY(unsigned) indices; }; @@ -498,9 +498,9 @@ static void ProcessManifestEntry (void * param, ENetError error) { ); uint32_t start = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs); if(!MD5Check(path, p->mr->manifest[p->index].md5)) { - p->mr->critsect.Enter(); + p->mr->critsect.Lock(); p->mr->indices.Add(p->index); - p->mr->critsect.Leave(); + p->mr->critsect.Unlock(); AtomicAdd(&ProgressStream::totalBytes, p->mr->manifest[p->index].zipSize); } diff --git a/Sources/Plasma/Apps/plUruLauncher/Main.cpp b/Sources/Plasma/Apps/plUruLauncher/Main.cpp index 2c41a352..2e35b79e 100644 --- a/Sources/Plasma/Apps/plUruLauncher/Main.cpp +++ b/Sources/Plasma/Apps/plUruLauncher/Main.cpp @@ -149,7 +149,7 @@ static HANDLE s_event; static HINSTANCE s_hInstance; static HWND s_dialog; static hsSemaphore s_dialogCreateEvent(0); -static CCritSect s_critsect; +static hsMutex s_critsect; static LISTDECL(WndEvent, link) s_eventQ; static hsSemaphore s_shutdownEvent(0); static wchar_t s_workingDir[MAX_PATH]; @@ -197,9 +197,9 @@ static void Abort () { //============================================================================ static void PostEvent (WndEvent *event) { - s_critsect.Enter(); + s_critsect.Lock(); s_eventQ.Link(event); - s_critsect.Leave(); + s_critsect.Unlock(); } //============================================================================ @@ -394,11 +394,11 @@ static void Recv_SetBytesRemaining (HWND hwnd, const SetBytesRemainingEvent &eve static void DispatchEvents (HWND hwnd) { LISTDECL(WndEvent, link) eventQ; - s_critsect.Enter(); + s_critsect.Lock(); { eventQ.Link(&s_eventQ); } - s_critsect.Leave(); + s_critsect.Unlock(); #define DISPATCH(a) case kEvent##a: Recv_##a(hwnd, *(const a##Event *) event); break while (WndEvent *event = eventQ.Head()) {