foobar2000 SDK  2015-08-03
Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
CSRWlock

#include <WTL-PP.h>

Public Member Functions

 CSRWlock ()
 
void EnterExclusive ()
 
void EnterShared ()
 
bool HaveAPI ()
 
void LeaveExclusive ()
 
void LeaveShared ()
 

Private Member Functions

 CSRWlock (const CSRWlock &)
 
void operator= (const CSRWlock &)
 
 VOID (WINAPI *AcquireSRWLockExclusive)(PSRWLOCK SRWLock)
 
 VOID (WINAPI *AcquireSRWLockShared)(PSRWLOCK SRWLock)
 
 VOID (WINAPI *ReleaseSRWLockExclusive)(PSRWLOCK SRWLock)
 
 VOID (WINAPI *ReleaseSRWLockShared)(PSRWLOCK SRWLock)
 

Static Private Member Functions

template<typename func_t >
static void Bind (func_t &func, HMODULE dll, const char *name)
 

Private Attributes

SRWLOCK theLock
 

Detailed Description

Definition at line 254 of file WTL-PP.h.

Constructor & Destructor Documentation

CSRWlock::CSRWlock ( )
inline

Definition at line 256 of file WTL-PP.h.

256  : theLock() {
257 #if _WIN32_WINNT < 0x600
258  auto dll = GetModuleHandle(_T("kernel32"));
259  Bind(AcquireSRWLockExclusive, dll, "AcquireSRWLockExclusive");
260  Bind(AcquireSRWLockShared, dll, "AcquireSRWLockShared");
261  Bind(ReleaseSRWLockExclusive, dll, "ReleaseSRWLockExclusive");
262  Bind(ReleaseSRWLockShared, dll, "ReleaseSRWLockShared");
263 #endif
264  }
SRWLOCK theLock
Definition: WTL-PP.h:291
static void Bind(func_t &func, HMODULE dll, const char *name)
Definition: WTL-PP.h:293
CSRWlock::CSRWlock ( const CSRWlock )
private

Member Function Documentation

template<typename func_t >
static void CSRWlock::Bind ( func_t &  func,
HMODULE  dll,
const char *  name 
)
inlinestaticprivate

Definition at line 293 of file WTL-PP.h.

293  {
294  func = reinterpret_cast<func_t>(GetProcAddress( dll, name ) );
295  }
void CSRWlock::EnterExclusive ( )
inline

Definition at line 277 of file WTL-PP.h.

277  {
278  AcquireSRWLockExclusive( & theLock );
279  }
SRWLOCK theLock
Definition: WTL-PP.h:291
void CSRWlock::EnterShared ( )
inline

Definition at line 274 of file WTL-PP.h.

274  {
275  AcquireSRWLockShared( & theLock );
276  }
SRWLOCK theLock
Definition: WTL-PP.h:291
bool CSRWlock::HaveAPI ( )
inline

Definition at line 266 of file WTL-PP.h.

266  {
267 #if _WIN32_WINNT < 0x600
268  return AcquireSRWLockExclusive != NULL;
269 #else
270  return true;
271 #endif
272  }
void CSRWlock::LeaveExclusive ( )
inline

Definition at line 283 of file WTL-PP.h.

283  {
284  ReleaseSRWLockExclusive( &theLock );
285  }
SRWLOCK theLock
Definition: WTL-PP.h:291
void CSRWlock::LeaveShared ( )
inline

Definition at line 280 of file WTL-PP.h.

280  {
281  ReleaseSRWLockShared( & theLock );
282  }
SRWLOCK theLock
Definition: WTL-PP.h:291
void CSRWlock::operator= ( const CSRWlock )
private
CSRWlock::VOID ( WINAPI *  AcquireSRWLockExclusive)
private
CSRWlock::VOID ( WINAPI *  AcquireSRWLockShared)
private
CSRWlock::VOID ( WINAPI *  ReleaseSRWLockExclusive)
private
CSRWlock::VOID ( WINAPI *  ReleaseSRWLockShared)
private

Field Documentation

SRWLOCK CSRWlock::theLock
private

Definition at line 291 of file WTL-PP.h.


The documentation for this class was generated from the following file: