include/csrss/csrss.h: Include a define for the size of the common
[reactos.git] / reactos / ntoskrnl / lpc / queue.c
1 /* $Id: queue.c,v 1.4 2001/11/25 15:21:10 dwelch Exp $
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS kernel
5 * FILE: ntoskrnl/lpc/queue.c
6 * PURPOSE: Communication mechanism
7 * PROGRAMMER: David Welch (welch@cwcom.net)
8 * UPDATE HISTORY:
9 * Created 22/05/98
10 */
11
12 /* INCLUDES *****************************************************************/
13
14 #include <ddk/ntddk.h>
15 #include <internal/ob.h>
16 #include <internal/port.h>
17 #include <internal/dbg.h>
18
19 #define NDEBUG
20 #include <internal/debug.h>
21
22
23 VOID STDCALL
24 EiEnqueueMessagePort (IN OUT PEPORT Port,
25 IN PQUEUEDMESSAGE Message)
26 {
27 InsertTailList (&Port->QueueListHead,
28 &Message->QueueListEntry);
29 Port->QueueLength++;
30 }
31
32 VOID STDCALL
33 EiEnqueueMessageAtHeadPort (IN OUT PEPORT Port,
34 IN PQUEUEDMESSAGE Message)
35 {
36 InsertTailList (&Port->QueueListHead,
37 &Message->QueueListEntry);
38 Port->QueueLength++;
39 }
40
41 PQUEUEDMESSAGE STDCALL
42 EiDequeueMessagePort (IN OUT PEPORT Port)
43 {
44 PQUEUEDMESSAGE Message;
45 PLIST_ENTRY entry;
46
47 if (IsListEmpty(&Port->QueueListHead))
48 {
49 return(NULL);
50 }
51 entry = RemoveHeadList (&Port->QueueListHead);
52 Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
53 Port->QueueLength--;
54
55 return (Message);
56 }
57
58
59 VOID STDCALL
60 EiEnqueueConnectMessagePort (IN OUT PEPORT Port,
61 IN PQUEUEDMESSAGE Message)
62 {
63 InsertTailList (&Port->ConnectQueueListHead,
64 &Message->QueueListEntry);
65 Port->ConnectQueueLength++;
66 }
67
68
69 PQUEUEDMESSAGE STDCALL
70 EiDequeueConnectMessagePort (IN OUT PEPORT Port)
71 {
72 PQUEUEDMESSAGE Message;
73 PLIST_ENTRY entry;
74
75 if (IsListEmpty(&Port->ConnectQueueListHead))
76 {
77 return(NULL);
78 }
79 entry = RemoveHeadList (&Port->ConnectQueueListHead);
80 Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
81 Port->ConnectQueueLength--;
82
83 return (Message);
84 }
85
86
87 /* EOF */