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.

58 lines
975 B

  1. /*++
  2. Copyright (c) 1995-1996 Microsoft Corporation
  3. Module Name:
  4. bufpool.h
  5. Abstract:
  6. The class defined here manages a pool of fixed-size buffers that are typically used
  7. for network packets or sound buffers.
  8. --*/
  9. #ifndef _BUFPOOL_H_
  10. #define _BUFPOOL_H_
  11. #include <pshpack8.h> /* Assume 8 byte packing throughout */
  12. class BufferPool
  13. {
  14. private:
  15. BOOL m_fInitialized;
  16. ULONG m_cbSizeBuf;
  17. UINT m_cBufAlloc;
  18. UINT m_cBufFree;
  19. PVOID m_pAlloc;
  20. PVOID m_pBufFree;
  21. // intra-process/inter-thread synchronization
  22. CRITICAL_SECTION m_CritSect;
  23. private:
  24. void _Construct ( void );
  25. void _Destruct ( void );
  26. public:
  27. BufferPool ( void );
  28. ~BufferPool ( void );
  29. HRESULT Initialize ( UINT uBuf, ULONG cbSizeBuf );
  30. PVOID GetBuffer ( void );
  31. void ReturnBuffer ( PVOID pBuf );
  32. ULONG GetMaxBufferSize ( void );
  33. void Release ( void );
  34. };
  35. #include <poppack.h> /* End byte packing */
  36. #endif // _BUFPOOL_H_