|
@@ -15,8 +15,8 @@ DWORD g_new_thread_id = 0;
|
|
|
static DWORD WINAPI thread_func(LPVOID arg)
|
|
|
{
|
|
|
/* exists of the thread the quickest as possible */
|
|
|
- Sleep(3000);
|
|
|
g_new_thread_id = GetCurrentThreadId();
|
|
|
+ Sleep(3000);
|
|
|
ExitThread(0);
|
|
|
return 0;
|
|
|
}
|
|
@@ -24,6 +24,7 @@ static DWORD WINAPI thread_func(LPVOID arg)
|
|
|
int TestThreadGetHandle(int argc, char* argv[])
|
|
|
{
|
|
|
HANDLE thread;
|
|
|
+ HANDLE openThread;
|
|
|
DWORD waitResult;
|
|
|
DWORD threadID;
|
|
|
threadID = 0;
|
|
@@ -49,9 +50,9 @@ int TestThreadGetHandle(int argc, char* argv[])
|
|
|
fprintf(stderr, "global thread id %d does not equals with returned thread id %d", g_new_thread_id, threadID);
|
|
|
return -1;
|
|
|
}
|
|
|
-
|
|
|
- if(thread != OpenThread(0, FALSE, threadID)) {
|
|
|
- fprintf(stderr, "open thread and get handle is not the same as before returned one!");
|
|
|
+ openThread = OpenThread(THREAD_ALL_ACCESS, FALSE, threadID);
|
|
|
+ if(NULL == openThread) {
|
|
|
+ fprintf(stderr, "open thread and get handle is null!");
|
|
|
return -1;
|
|
|
}
|
|
|
return 0;
|