Browse Source

Get rid of CCritSect in the patcher stuff.

Darryl Pogue 13 years ago
parent
commit
833124c297
  1. 6
      Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp
  2. 10
      Sources/Plasma/Apps/plUruLauncher/Main.cpp

6
Sources/Plasma/Apps/plClientPatcher/UruPlayer.cpp

@ -113,7 +113,7 @@ struct ManifestResult {
long * indicator; long * indicator;
plLauncherInfo * info; plLauncherInfo * info;
CCritSect critsect; hsMutex critsect;
ARRAY(unsigned) indices; ARRAY(unsigned) indices;
}; };
@ -498,9 +498,9 @@ static void ProcessManifestEntry (void * param, ENetError error) {
); );
uint32_t start = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs); uint32_t start = (uint32_t)(TimeGetTime() / kTimeIntervalsPerMs);
if(!MD5Check(path, p->mr->manifest[p->index].md5)) { 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->indices.Add(p->index);
p->mr->critsect.Leave(); p->mr->critsect.Unlock();
AtomicAdd(&ProgressStream::totalBytes, p->mr->manifest[p->index].zipSize); AtomicAdd(&ProgressStream::totalBytes, p->mr->manifest[p->index].zipSize);
} }

10
Sources/Plasma/Apps/plUruLauncher/Main.cpp

@ -149,7 +149,7 @@ static HANDLE s_event;
static HINSTANCE s_hInstance; static HINSTANCE s_hInstance;
static HWND s_dialog; static HWND s_dialog;
static hsSemaphore s_dialogCreateEvent(0); static hsSemaphore s_dialogCreateEvent(0);
static CCritSect s_critsect; static hsMutex s_critsect;
static LISTDECL(WndEvent, link) s_eventQ; static LISTDECL(WndEvent, link) s_eventQ;
static hsSemaphore s_shutdownEvent(0); static hsSemaphore s_shutdownEvent(0);
static wchar_t s_workingDir[MAX_PATH]; static wchar_t s_workingDir[MAX_PATH];
@ -197,9 +197,9 @@ static void Abort () {
//============================================================================ //============================================================================
static void PostEvent (WndEvent *event) { static void PostEvent (WndEvent *event) {
s_critsect.Enter(); s_critsect.Lock();
s_eventQ.Link(event); 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) { static void DispatchEvents (HWND hwnd) {
LISTDECL(WndEvent, link) eventQ; LISTDECL(WndEvent, link) eventQ;
s_critsect.Enter(); s_critsect.Lock();
{ {
eventQ.Link(&s_eventQ); eventQ.Link(&s_eventQ);
} }
s_critsect.Leave(); s_critsect.Unlock();
#define DISPATCH(a) case kEvent##a: Recv_##a(hwnd, *(const a##Event *) event); break #define DISPATCH(a) case kEvent##a: Recv_##a(hwnd, *(const a##Event *) event); break
while (WndEvent *event = eventQ.Head()) { while (WndEvent *event = eventQ.Head()) {

Loading…
Cancel
Save