mirror of
https://github.com/solemnwarning/directplay-lite
synced 2024-12-30 16:45:37 +01:00
Add missing lock uses in DirectPlay8Peer
This commit is contained in:
parent
9fc69d67ea
commit
0239e5357d
@ -103,6 +103,8 @@ ULONG DirectPlay8Peer::Release(void)
|
|||||||
|
|
||||||
HRESULT DirectPlay8Peer::Initialize(PVOID CONST pvUserContext, CONST PFNDPNMESSAGEHANDLER pfn, CONST DWORD dwFlags)
|
HRESULT DirectPlay8Peer::Initialize(PVOID CONST pvUserContext, CONST PFNDPNMESSAGEHANDLER pfn, CONST DWORD dwFlags)
|
||||||
{
|
{
|
||||||
|
std::unique_lock<std::mutex> l(lock);
|
||||||
|
|
||||||
if(state != STATE_NEW)
|
if(state != STATE_NEW)
|
||||||
{
|
{
|
||||||
return DPNERR_ALREADYINITIALIZED;
|
return DPNERR_ALREADYINITIALIZED;
|
||||||
@ -717,6 +719,8 @@ HRESULT DirectPlay8Peer::GetSendQueueInfo(CONST DPNID dpnid, DWORD* CONST pdwNum
|
|||||||
|
|
||||||
HRESULT DirectPlay8Peer::Host(CONST DPN_APPLICATION_DESC* CONST pdnAppDesc, IDirectPlay8Address **CONST prgpDeviceInfo, CONST DWORD cDeviceInfo, CONST DPN_SECURITY_DESC* CONST pdnSecurity, CONST DPN_SECURITY_CREDENTIALS* CONST pdnCredentials, void* CONST pvPlayerContext, CONST DWORD dwFlags)
|
HRESULT DirectPlay8Peer::Host(CONST DPN_APPLICATION_DESC* CONST pdnAppDesc, IDirectPlay8Address **CONST prgpDeviceInfo, CONST DWORD cDeviceInfo, CONST DPN_SECURITY_DESC* CONST pdnSecurity, CONST DPN_SECURITY_CREDENTIALS* CONST pdnCredentials, void* CONST pvPlayerContext, CONST DWORD dwFlags)
|
||||||
{
|
{
|
||||||
|
std::unique_lock<std::mutex> l(lock);
|
||||||
|
|
||||||
switch(state)
|
switch(state)
|
||||||
{
|
{
|
||||||
case STATE_NEW: return DPNERR_UNINITIALIZED;
|
case STATE_NEW: return DPNERR_UNINITIALIZED;
|
||||||
@ -1539,6 +1543,8 @@ HRESULT DirectPlay8Peer::Close(CONST DWORD dwFlags)
|
|||||||
|
|
||||||
HRESULT DirectPlay8Peer::EnumHosts(PDPN_APPLICATION_DESC CONST pApplicationDesc, IDirectPlay8Address* CONST pAddrHost, IDirectPlay8Address* CONST pDeviceInfo,PVOID CONST pUserEnumData, CONST DWORD dwUserEnumDataSize, CONST DWORD dwEnumCount, CONST DWORD dwRetryInterval, CONST DWORD dwTimeOut,PVOID CONST pvUserContext, DPNHANDLE* CONST pAsyncHandle, CONST DWORD dwFlags)
|
HRESULT DirectPlay8Peer::EnumHosts(PDPN_APPLICATION_DESC CONST pApplicationDesc, IDirectPlay8Address* CONST pAddrHost, IDirectPlay8Address* CONST pDeviceInfo,PVOID CONST pUserEnumData, CONST DWORD dwUserEnumDataSize, CONST DWORD dwEnumCount, CONST DWORD dwRetryInterval, CONST DWORD dwTimeOut,PVOID CONST pvUserContext, DPNHANDLE* CONST pAsyncHandle, CONST DWORD dwFlags)
|
||||||
{
|
{
|
||||||
|
std::unique_lock<std::mutex> l(lock);
|
||||||
|
|
||||||
if(state == STATE_NEW)
|
if(state == STATE_NEW)
|
||||||
{
|
{
|
||||||
return DPNERR_UNINITIALIZED;
|
return DPNERR_UNINITIALIZED;
|
||||||
@ -1562,6 +1568,7 @@ HRESULT DirectPlay8Peer::EnumHosts(PDPN_APPLICATION_DESC CONST pApplicationDesc,
|
|||||||
result = r;
|
result = r;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
l.unlock();
|
||||||
he.wait();
|
he.wait();
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
@ -1571,8 +1578,6 @@ HRESULT DirectPlay8Peer::EnumHosts(PDPN_APPLICATION_DESC CONST pApplicationDesc,
|
|||||||
|
|
||||||
*pAsyncHandle = handle;
|
*pAsyncHandle = handle;
|
||||||
|
|
||||||
std::unique_lock<std::mutex> l(lock);
|
|
||||||
|
|
||||||
host_enums.emplace(
|
host_enums.emplace(
|
||||||
std::piecewise_construct,
|
std::piecewise_construct,
|
||||||
std::forward_as_tuple(handle),
|
std::forward_as_tuple(handle),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user