File: WaitOnAddress.cpp

package info (click to toggle)
jazz2-native 3.5.0-2
  • links: PTS, VCS
  • area: contrib
  • in suites: forky, sid
  • size: 16,912 kB
  • sloc: cpp: 172,557; xml: 113; python: 36; makefile: 5; sh: 2
file content (26 lines) | stat: -rw-r--r-- 1,019 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "WaitOnAddress.h"
#include "../../Asserts.h"

namespace Death { namespace Threading { namespace Implementation {
//###==##====#=====--==~--~=~- --- -- -  -  -   -

#if defined(DEATH_TARGET_WINDOWS)
	WaitOnAddressDelegate* _waitOnAddress = nullptr;
	WakeByAddressAllDelegate* _wakeByAddressAll = nullptr;
	WakeByAddressAllDelegate* _wakeByAddressSingle = nullptr;

	void InitializeWaitOnAddress()
	{
		if (_waitOnAddress == nullptr || _wakeByAddressAll == nullptr || _wakeByAddressSingle == nullptr) {
			HMODULE kernelBase = ::GetModuleHandle(L"KernelBase.dll");
			_waitOnAddress = GetProcAddressByFunctionDeclaration(kernelBase, WaitOnAddress);
			DEATH_DEBUG_ASSERT(_waitOnAddress != nullptr);
			_wakeByAddressAll = GetProcAddressByFunctionDeclaration(kernelBase, WakeByAddressAll);
			DEATH_DEBUG_ASSERT(_wakeByAddressAll != nullptr);
			_wakeByAddressSingle = GetProcAddressByFunctionDeclaration(kernelBase, WakeByAddressSingle);
			DEATH_DEBUG_ASSERT(_wakeByAddressSingle != nullptr);
		}
	}
#endif

}}}