|
1 /* |
|
2 * Copyright (c) 1999 - 2001 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 /***************************************************************** |
|
20 |
|
21 Subsystem Name: ProtectedSignaledQueue |
|
22 Version: V1.0 |
|
23 Description: |
|
24 Provides interfaces to a Protected, Signaled, Queue. This is a queue that |
|
25 can be have multiple readers and writers running in separate threads. |
|
26 When something is added to the queue a signal is set. |
|
27 ******************************************************************/ |
|
28 #ifndef NWX_PSQ_H |
|
29 #define NWX_PSQ_H |
|
30 |
|
31 #ifdef __cplusplus |
|
32 extern "C" { |
|
33 #endif |
|
34 |
|
35 |
|
36 /* |
|
37 ** Includes |
|
38 */ |
|
39 |
|
40 #include "nwx_defs.h" |
|
41 #include "nwx_datastruct.h" |
|
42 #include "nwx_osu.h" |
|
43 #include "BrsrStatusCodes.h" |
|
44 |
|
45 /* |
|
46 ** Type Definitions |
|
47 */ |
|
48 |
|
49 typedef struct { |
|
50 NW_Node_t *head; /* queue head */ |
|
51 NW_Node_t *tail; /* queue tail */ |
|
52 NW_Osu_Signal_t *signal; /* signal this when adding */ |
|
53 NW_Osu_Mutex_t *mutex; /* mutex for locking and unlocking */ |
|
54 NW_Ucs2 *name; /* name of queue (for debugging only) */ |
|
55 NW_Uint16 length; /* number of nodes in queue */ |
|
56 } NW_Psq_t; |
|
57 |
|
58 |
|
59 /* |
|
60 ** Global Function Declarations |
|
61 */ |
|
62 |
|
63 /* create a new Protected Signaled Queue */ |
|
64 NW_Psq_t *NW_Psq_New(const char *name); |
|
65 |
|
66 /* delete a Protected Signaled Queue */ |
|
67 void NW_Psq_Delete(NW_Psq_t *que); |
|
68 |
|
69 /* add a new node to the tail of the queue */ |
|
70 void NW_Psq_AddTail(NW_Psq_t *que, NW_Node_t *node); |
|
71 |
|
72 /* return node from the head of the queue and remove it */ |
|
73 NW_Node_t *NW_Psq_RemoveHead(NW_Psq_t *que); |
|
74 |
|
75 /* wait for node to be added to queue */ |
|
76 TBrowserStatusCode NW_Psq_WaitForAdd(const NW_Psq_t *que, const NW_Int32 howLong); |
|
77 |
|
78 |
|
79 |
|
80 #ifdef __cplusplus |
|
81 } /* extern "C" */ |
|
82 #endif |
|
83 |
|
84 #endif /* NWX_PSQ_H */ |