Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
627 B

  1. #include <assert.h>
  2. #include <stdio.h>
  3. #include <windows.h>
  4. #include <string.h>
  5. VOID
  6. TestThread(
  7. LPVOID ThreadParameter
  8. )
  9. {
  10. OutputDebugString("Thread Started\n");
  11. while(1);
  12. }
  13. DWORD
  14. main(
  15. int argc,
  16. char *argv[],
  17. char *envp[]
  18. )
  19. {
  20. HANDLE Thread;
  21. DWORD ThreadId;
  22. DWORD st;
  23. Thread = CreateThread(NULL,0L,TestThread,(LPVOID)99,0,&ThreadId);
  24. assert(Thread);
  25. Sleep(3000);
  26. OutputDebugString("Out of Sleep\n");
  27. TerminateThread(Thread,1);
  28. st = WaitForSingleObject(Thread,-1);
  29. assert(st == 0);
  30. assert(GetExitCodeThread(Thread,&st));
  31. assert(st = 1);
  32. }