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.

55 lines
802 B

  1. // worker.cpp
  2. //
  3. #include "stdpch.h"
  4. #pragma hdrstop
  5. #include "queue.h"
  6. #include "command.h" // CCommand
  7. #include "worker.h"
  8. CQueue<CCommand*, WorkerThread> g_Q;
  9. DWORD WINAPI WorkerThread(LPVOID lpv)
  10. {
  11. CCommand * pCmd;
  12. HANDLE hThread;
  13. hThread = GetCurrentThread();
  14. SetThreadPriority(hThread, THREAD_PRIORITY_LOWEST);
  15. while(g_Q.Wait(pCmd))
  16. {
  17. try
  18. {
  19. pCmd->Go();
  20. // put in undo list
  21. delete pCmd;
  22. }
  23. catch(int )
  24. {
  25. // hmmm, I am just catching shutdown
  26. }
  27. catch(...)
  28. {
  29. }
  30. }
  31. return 0;
  32. }
  33. #ifdef NOTHING // DEBUG
  34. void* __cdecl ::operator new(size_t n)
  35. {
  36. return 0;
  37. }
  38. void __cdecl ::operator delete(void* p)
  39. {
  40. }
  41. int __cdecl atexit( void ( __cdecl *func )( void ) )
  42. {
  43. return 0;
  44. }
  45. #endif