]> pd.if.org Git - liblfds/blob - liblfds/liblfds6.0.0/liblfds600/src/lfds600_stack/lfds600_stack_internal.h
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds6.0.0 / liblfds600 / src / lfds600_stack / lfds600_stack_internal.h
1 /***** the library wide include file *****/
2 #include "lfds600_internal.h"
3
4 /***** pragmas *****/
5
6 /***** defines *****/
7 #define LFDS600_STACK_POINTER 0
8 #define LFDS600_STACK_COUNTER 1
9 #define LFDS600_STACK_PAC_SIZE 2
10
11 /***** structures *****/
12 #pragma pack( push, LFDS600_ALIGN_DOUBLE_POINTER )
13
14 struct lfds600_stack_state
15 {
16   // TRD : must come first for alignment
17   struct lfds600_stack_element
18     *volatile top[LFDS600_STACK_PAC_SIZE];
19
20   lfds600_atom_t
21     aba_counter;
22
23   struct lfds600_freelist_state
24     *fs;
25 };
26
27 struct lfds600_stack_element
28 {
29   struct lfds600_stack_element
30     *next[LFDS600_STACK_PAC_SIZE];
31
32   struct lfds600_freelist_element
33     *fe;
34
35   void
36     *user_data;
37 };
38
39 #pragma pack( pop )
40
41 /***** private prototypes *****/
42 int lfds600_stack_internal_freelist_init_function( void **user_data, void *user_state );
43 void lfds600_stack_internal_freelist_delete_function( void *user_data, void *user_state );
44
45 void lfds600_stack_internal_new_element_from_freelist( struct lfds600_stack_state *ss, struct lfds600_stack_element *se[LFDS600_STACK_PAC_SIZE], void *user_data );
46 void lfds600_stack_internal_new_element( struct lfds600_stack_state *ss, struct lfds600_stack_element *se[LFDS600_STACK_PAC_SIZE], void *user_data );
47 void lfds600_stack_internal_init_element( struct lfds600_stack_state *ss, struct lfds600_stack_element *se[LFDS600_STACK_PAC_SIZE], struct lfds600_freelist_element *fe, void *user_data );
48
49 void lfds600_stack_internal_push( struct lfds600_stack_state *ss, struct lfds600_stack_element *se[LFDS600_STACK_PAC_SIZE] );
50