c98fbf20bc352a924ac0d0911fe46ea15b9daf2e
[reactos.git] / reactos / ntoskrnl / lpc / queue.c
1 /* $Id$
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 <ntoskrnl.h>
15 #define NDEBUG
16 #include <internal/debug.h>
17
18 /* FUNCTIONS *****************************************************************/
19
20 VOID STDCALL
21 EiEnqueueMessagePort (IN OUT PEPORT Port,
22 IN PQUEUEDMESSAGE Message)
23 {
24 InsertTailList (&Port->QueueListHead,
25 &Message->QueueListEntry);
26 Port->QueueLength++;
27 }
28
29 VOID STDCALL
30 EiEnqueueMessageAtHeadPort (IN OUT PEPORT Port,
31 IN PQUEUEDMESSAGE Message)
32 {
33 InsertTailList (&Port->QueueListHead,
34 &Message->QueueListEntry);
35 Port->QueueLength++;
36 }
37
38 PQUEUEDMESSAGE STDCALL
39 EiDequeueMessagePort (IN OUT PEPORT Port)
40 {
41 PQUEUEDMESSAGE Message;
42 PLIST_ENTRY entry;
43
44 if (IsListEmpty(&Port->QueueListHead))
45 {
46 return(NULL);
47 }
48 entry = RemoveHeadList (&Port->QueueListHead);
49 Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
50 Port->QueueLength--;
51
52 return (Message);
53 }
54
55
56 VOID STDCALL
57 EiEnqueueConnectMessagePort (IN OUT PEPORT Port,
58 IN PQUEUEDMESSAGE Message)
59 {
60 InsertTailList (&Port->ConnectQueueListHead,
61 &Message->QueueListEntry);
62 Port->ConnectQueueLength++;
63 }
64
65
66 PQUEUEDMESSAGE STDCALL
67 EiDequeueConnectMessagePort (IN OUT PEPORT Port)
68 {
69 PQUEUEDMESSAGE Message;
70 PLIST_ENTRY entry;
71
72 if (IsListEmpty(&Port->ConnectQueueListHead))
73 {
74 return(NULL);
75 }
76 entry = RemoveHeadList (&Port->ConnectQueueListHead);
77 Message = CONTAINING_RECORD (entry, QUEUEDMESSAGE, QueueListEntry);
78 Port->ConnectQueueLength--;
79
80 return (Message);
81 }
82
83
84 /* EOF */