-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from CookiePLMonster/cdstream-deadlock
Fixed a deadlock in CdStream and LoadLibrary path translation heuristics
- Loading branch information
Showing
15 changed files
with
309 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#pragma once | ||
#include <windows.h> | ||
#include "CdStreamInfo.h" | ||
|
||
struct CdStream; | ||
|
||
namespace CdStreamSyncFix | ||
{ | ||
union SyncObj | ||
{ | ||
HANDLE semaphore; | ||
CONDITION_VARIABLE cv; | ||
}; | ||
|
||
struct SyncFuncs | ||
{ | ||
SyncObj (__stdcall* Initialize)(); | ||
void (__stdcall* Shutdown)( CdStream* stream ); | ||
void (__stdcall* SleepCS)( CdStream* stream, PCRITICAL_SECTION critSec ); | ||
void (__stdcall* Wake)( CdStream* stream ); | ||
}; | ||
|
||
namespace Sema | ||
{ | ||
SyncObj __stdcall Initialize(); | ||
void __stdcall Shutdown( CdStream* stream ); | ||
void __stdcall SleepCS( CdStream* stream, PCRITICAL_SECTION critSec ); | ||
void __stdcall Wake( CdStream* stream ); | ||
} | ||
|
||
namespace CV | ||
{ | ||
SyncObj __stdcall Initialize(); | ||
void __stdcall Shutdown( CdStream* stream ); | ||
void __stdcall SleepCS( CdStream* stream, PCRITICAL_SECTION critSec ); | ||
void __stdcall Wake( CdStream* stream ); | ||
} | ||
|
||
bool TryInitCV(); | ||
|
||
inline SyncFuncs InitializeSyncFuncs() | ||
{ | ||
SyncFuncs funcs; | ||
if ( TryInitCV() ) | ||
{ | ||
using namespace CV; | ||
funcs.Initialize = Initialize; | ||
funcs.Shutdown = Shutdown; | ||
funcs.SleepCS = SleepCS; | ||
funcs.Wake = Wake; | ||
} | ||
else | ||
{ | ||
using namespace Sema; | ||
funcs.Initialize = Initialize; | ||
funcs.Shutdown = Shutdown; | ||
funcs.SleepCS = SleepCS; | ||
funcs.Wake = Wake; | ||
} | ||
return funcs; | ||
} | ||
} | ||
|
||
static_assert(sizeof(CdStreamSyncFix::SyncObj) == sizeof(HANDLE), "Incorrect struct size: CdStreamSync::SyncObj"); |
Oops, something went wrong.