22 return this->
Core (0);
29 auto threadFunc = [](LPVOID lpvParam)->DWORD
35 event.Open (_T (
"START_EVENT"));
38 OutputDebugString (_T (
"Thread action is started.\n"));
41 int index = rand () % 10;
43 wsprintf (tsz, _T (
"%d(%d),"), GetCurrentThreadId (), index);
44 OutputDebugString (tsz);
46 LPVOID lpvMem =
new BYTE[me->
_allocSize[index]];
52 OutputDebugString (_T (
"Thread action is stopped.\n"));
58 event.
Create (_T (
"START_EVENT"), TRUE, FALSE);
61 const int numOfThreads = 48;
65 for (
auto& item : thread)
67 item.
Create (threadFunc, (LPVOID)
this);
72 HANDLE threadHandles[numOfThreads];
73 for (
int i = 0; i < numOfThreads; i++)
75 threadHandles[i] = thread[i].
GetHandle ();
83 WaitForMultipleObjects (numOfThreads, threadHandles, TRUE, INFINITE);
88 int msec =
static_cast<int>(Q.
PastTime ());
DWORD APIENTRY Write(LPCTSTR lpctszString) const
コンソールに文字を出力します。
VOID APIENTRY Format(LPCTSTR format,...) const
コンソールに文字を出力します。
イベントに関するWindowsAPIを集約したクラス
BOOL APIENTRY Create(LPCTSTR lpctszName, BOOL bManualReset, BOOL bInitialState)
イベントを作成します。
HANDLE APIENTRY GetHandle() const
継承先はこの関数でハンドルを取得します。
スレッドに関するWindowsAPIを集約したクラス
BOOL APIENTRY Create(PTHREAD_START_ROUTINE function=NULL, LPVOID lpvParam=NULL, DWORD dwCreationFlag=0)
スレッドを作成します。