]> pd.if.org Git - liblfds/blob - liblfds/liblfds6.0.1/liblfds601/src/lfds601_queue/lfds601_queue_internal.h
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds6.0.1 / liblfds601 / src / lfds601_queue / lfds601_queue_internal.h
1 /***** the library wide include file *****/\r
2 #include "lfds601_internal.h"\r
3 \r
4 /***** pragmas *****/\r
5 \r
6 /***** defines *****/\r
7 #define LFDS601_QUEUE_STATE_UNKNOWN               -1\r
8 #define LFDS601_QUEUE_STATE_EMPTY                  0\r
9 #define LFDS601_QUEUE_STATE_ENQUEUE_OUT_OF_PLACE   1\r
10 #define LFDS601_QUEUE_STATE_ATTEMPT_DELFDS601_QUEUE        2\r
11 \r
12 #define LFDS601_QUEUE_POINTER 0\r
13 #define LFDS601_QUEUE_COUNTER 1\r
14 #define LFDS601_QUEUE_PAC_SIZE 2\r
15 \r
16 /***** structures *****/\r
17 #pragma pack( push, LFDS601_ALIGN_DOUBLE_POINTER )\r
18 \r
19 struct lfds601_queue_state\r
20 {\r
21   struct lfds601_queue_element\r
22     *volatile enqueue[LFDS601_QUEUE_PAC_SIZE],\r
23     *volatile dequeue[LFDS601_QUEUE_PAC_SIZE];\r
24 \r
25   lfds601_atom_t\r
26     aba_counter;\r
27 \r
28   struct lfds601_freelist_state\r
29     *fs;\r
30 };\r
31 \r
32 struct lfds601_queue_element\r
33 {\r
34   // TRD : next in a lfds601_queue requires volatile as it is target of CAS\r
35   struct lfds601_queue_element\r
36     *volatile next[LFDS601_QUEUE_PAC_SIZE];\r
37 \r
38   struct lfds601_freelist_element\r
39     *fe;\r
40 \r
41   void\r
42     *user_data;\r
43 };\r
44 \r
45 #pragma pack( pop )\r
46 \r
47 /***** externs *****/\r
48 \r
49 /***** private prototypes *****/\r
50 int lfds601_queue_internal_freelist_init_function( void **user_data, void *user_state );\r
51 void lfds601_queue_internal_freelist_delete_function( void *user_data, void *user_state );\r
52 \r
53 void lfds601_queue_internal_new_element_from_freelist( struct lfds601_queue_state *qs, struct lfds601_queue_element *qe[LFDS601_QUEUE_PAC_SIZE], void *user_data );\r
54 void lfds601_queue_internal_guaranteed_new_element_from_freelist( struct lfds601_queue_state *qs, struct lfds601_queue_element * qe[LFDS601_QUEUE_PAC_SIZE], void *user_data );\r
55 void lfds601_queue_internal_init_element( struct lfds601_queue_state *qs, struct lfds601_queue_element *qe[LFDS601_QUEUE_PAC_SIZE], struct lfds601_freelist_element *fe, void *user_data );\r
56 \r
57 void lfds601_queue_internal_queue( struct lfds601_queue_state *qs, struct lfds601_queue_element *qe[LFDS601_QUEUE_PAC_SIZE] );\r
58 \r
59 void lfds601_queue_internal_validate( struct lfds601_queue_state *qs, struct lfds601_validation_info *vi, enum lfds601_data_structure_validity *lfds601_queue_validity, enum lfds601_data_structure_validity *lfds601_freelist_validity );\r
60 \r