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.

79 lines
3.3 KiB

  1. /*======================================================================================//
  2. | //
  3. |Copyright (c) 1998, 1999 Sequent Computer Systems, Incorporated. All rights reserved. //
  4. | //
  5. |Description: //
  6. | //
  7. |---------------------------------------------------------------------------------------//
  8. ; This file contains non-member functions to start ProcCon threads //
  9. |---------------------------------------------------------------------------------------//
  10. | //
  11. |Created: //
  12. | //
  13. | Jarl McDonald 04-99 //
  14. | //
  15. |Revision History: //
  16. | //
  17. |=======================================================================================*/
  18. #include "ProcConSvc.h"
  19. //=======================================================================================//
  20. // Functions to start various threads in Process Control.
  21. //
  22. // Input: pointer to thread context structure.
  23. // Returns: thread return code -- 0 for success, other for failure.
  24. //
  25. PCULONG32 _stdcall PCProcServer( void *ctxt ) {
  26. Sleep( 2000 ); // Wait a bit before we jump in
  27. ULONG rc = 1;
  28. PCContext *context = (PCContext *) ctxt;
  29. context->cMgr = new CProcConMgr( context );
  30. if ( !context->cMgr )
  31. PCLogNoMemory( TEXT("AllocProcConMgrClass"), sizeof(CProcConMgr) );
  32. else if ( context->cMgr->ReadyToRun() ) {
  33. context->cDB->SetPCMgr( context->cMgr ); // tell DB mgr about ProcCon mgr
  34. rc = context->cMgr->Run();
  35. }
  36. if ( rc && !context->cPC->GotShutdown() ) context->cPC->Stop();
  37. SetEvent( context->mgrDoneEvent );
  38. return rc;
  39. }
  40. PCULONG32 _stdcall PCUserServer( void *ctxt ) {
  41. Sleep( 2000 ); // Wait a bit before we jump in
  42. PCContext *context = (PCContext *) ctxt;
  43. context->cUser = new CProcConUser( context );
  44. if ( !context->cUser )
  45. PCLogNoMemory( TEXT("AllocProcConUserClass"), sizeof(CProcConUser) );
  46. else
  47. while ( context->cUser->ReadyToRun() ) context->cUser->Run();
  48. if ( !context->cPC->GotShutdown() ) context->cPC->Stop();
  49. SetEvent( context->userDoneEvent );
  50. return 0;
  51. }
  52. ULONG _stdcall PCClientThread( void *context ) {
  53. ULONG rc = 1;
  54. CProcConClient *cClient = new CProcConClient( (ClientContext *) context );
  55. if ( !cClient )
  56. PCLogNoMemory( TEXT("AllocProcConClientClass"), sizeof(CProcConClient) );
  57. else {
  58. if ( cClient->ReadyToRun() ) rc = cClient->Run();
  59. delete cClient;
  60. }
  61. return rc;
  62. }