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.

79 lines
1.5 KiB

  1. /*++
  2. rwexport.h
  3. This file defines a reader/writer lock implemented in rwnh.dll.
  4. We define the locks so that none of their internal workings is exposed.
  5. --*/
  6. #ifndef _RWEXPORT_H
  7. #define _RWEXPORT_H
  8. #ifdef _RW_IMPLEMENTATION_
  9. #define _RW_INTERFACE_ __declspec( dllexport )
  10. #else
  11. #define _RW_INTERFACE_ __declspec( dllimport )
  12. #endif
  13. class _RW_INTERFACE_ CShareLockExport {
  14. private :
  15. DWORD m_dwSignature ;
  16. enum constants {
  17. //
  18. // Signature in our objects !
  19. //
  20. SIGNATURE = (DWORD)'opxE'
  21. } ;
  22. //
  23. // Reserved space for the implementation !
  24. //
  25. DWORD m_dwReserved[16] ;
  26. public :
  27. CShareLockExport() ;
  28. ~CShareLockExport() ;
  29. //
  30. // Grab the lock Shared - other threads may pass through ShareLock() as well
  31. //
  32. void ShareLock() ;
  33. //
  34. // Releases the lock - if we are the last reader to leave writers may
  35. // start to enter the lock !
  36. //
  37. void ShareUnlock() ;
  38. //
  39. // Grab the lock Exclusively - no other readers or writers may enter !!
  40. //
  41. void ExclusiveLock() ;
  42. //
  43. // Release the Exclusive Locks - if there are readers waiting they
  44. // will enter before other waiting writers !
  45. //
  46. void ExclusiveUnlock() ;
  47. //
  48. // Convert an ExclusiveLock to a Shared - this cannot fail !
  49. //
  50. void ExclusiveToShared() ;
  51. //
  52. // Convert a Shared Lock to an Exclusive one - this can fail - returns
  53. // TRUE if successfull !
  54. //
  55. BOOL SharedToExclusive() ;
  56. BOOL TryShareLock() ;
  57. BOOL TryExclusiveLock() ;
  58. } ;
  59. #endif