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.

70 lines
2.3 KiB

  1. /*==========================================================================
  2. *
  3. * Copyright (C) 2001 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: dnnbqueue.h
  6. * Content: DirectPlay implementations of OS NBQueue functions
  7. *
  8. * History:
  9. * Date By Reason
  10. * ==== == ======
  11. * 10/31/2001 vanceo Adapted from ntos\inc\ex.h and ntos\ex\nbqueue.c.
  12. *
  13. ***************************************************************************/
  14. #ifndef __DNNBQUEUE_H__
  15. #define __DNNBQUEUE_H__
  16. //
  17. // A non-blocking queue is a singly linked list of queue entries with a head
  18. // pointer and a tail pointer. The head and tail pointers use sequenced
  19. // pointers as do next links in the entries themselves. The queueing
  20. // discipline is FIFO. New entries are inserted at the tail of the list and
  21. // current entries are removed from the front of the list.
  22. //
  23. // Non-blocking queues require an SList containing a DNNBQUEUE_BLOCK for each
  24. // entry to be tracked by the queue, plus one extra for bookkeeping. The
  25. // initialization and insert functions will assert (or access violate) if no
  26. // pre-allocated DNNBQUEUE_BLOCKs are found in the SList. The DNNBQUEUE_BLOCK
  27. // objects should just be cast directly to a DNSLIST_ENTRY when populating the
  28. // SList.
  29. //
  30. // It is important to remember that the duration a DNNBQUEUE_BLOCK is used for
  31. // tracking purproses will differ from any particular entry's duration in the
  32. // queue. Therefore pre-allocated DNNBQUEUE_BLOCKs should not come from the
  33. // same memory blocks as the entries being queued, unless it is guaranteed that
  34. // the non-blocking queue will be de-initialized before any of the entries are
  35. // freed.
  36. //
  37. typedef struct _DNNBQUEUE_BLOCK
  38. {
  39. ULONG64 Next;
  40. ULONG64 Data;
  41. } DNNBQUEUE_BLOCK, * PDNNBQUEUE_BLOCK;
  42. //
  43. // NBQueue access methods
  44. //
  45. PVOID WINAPI DNInitializeNBQueueHead(DNSLIST_HEADER * const pSlistHeadFreeNodes);
  46. void WINAPI DNDeinitializeNBQueueHead(PVOID const pvQueueHeader);
  47. void WINAPI DNInsertTailNBQueue(PVOID const pvQueueHeader, const ULONG64 Value);
  48. ULONG64 WINAPI DNRemoveHeadNBQueue(PVOID const pvQueueHeader);
  49. BOOL WINAPI DNIsNBQueueEmpty(PVOID const pvQueueHeader);
  50. void WINAPI DNAppendListNBQueue(PVOID const pvQueueHeader,
  51. DNSLIST_ENTRY * const pSlistEntryAppend,
  52. INT_PTR iValueOffset);
  53. #endif // __DNNBQUEUE_H__