Leaked source code of windows server 2003
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.

82 lines
1.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1991 - 1999
  6. //
  7. // File: svrapip.cxx
  8. //
  9. //--------------------------------------------------------------------------
  10. /* --------------------------------------------------------------------
  11. Microsoft OS/2 LAN Manager
  12. Copyright(c) Microsoft Corp., 1990
  13. -------------------------------------------------------------------- */
  14. /* --------------------------------------------------------------------
  15. File : svrapip.cxx
  16. Description :
  17. This file contains the private entry points into the server runtime.
  18. History :
  19. mikemon 02-02-91 Created.
  20. -------------------------------------------------------------------- */
  21. #include <precomp.hxx>
  22. void RPC_ENTRY
  23. I_RpcRequestMutex (
  24. IN OUT I_RPC_MUTEX * Mutex
  25. )
  26. {
  27. if (*Mutex == 0)
  28. {
  29. RPC_STATUS RpcStatus = RPC_S_OK;
  30. MUTEX *mutex = new MUTEX(&RpcStatus);
  31. if ( NULL == mutex )
  32. {
  33. RpcpRaiseException(RPC_S_OUT_OF_MEMORY);
  34. return;
  35. }
  36. if ( RpcStatus != RPC_S_OK )
  37. {
  38. delete mutex;
  39. RpcpRaiseException(RPC_S_OUT_OF_MEMORY);
  40. return;
  41. }
  42. if (InterlockedCompareExchangePointer(Mutex, mutex, NULL) != NULL)
  43. {
  44. delete mutex;
  45. }
  46. }
  47. ((MUTEX *) (*Mutex))->Request();
  48. }
  49. void RPC_ENTRY
  50. I_RpcClearMutex (
  51. IN I_RPC_MUTEX Mutex
  52. )
  53. {
  54. ((MUTEX *) Mutex)->Clear();
  55. }
  56. void RPC_ENTRY
  57. I_RpcDeleteMutex (
  58. IN I_RPC_MUTEX Mutex
  59. )
  60. {
  61. delete ((MUTEX *) Mutex);
  62. }