]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/liblfds710/src/lfds710_stack/lfds710_stack_init.c
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / liblfds710 / src / lfds710_stack / lfds710_stack_init.c
1 /***** includes *****/
2 #include "lfds710_stack_internal.h"
3
4
5
6
7
8 /****************************************************************************/
9 void lfds710_stack_init_valid_on_current_logical_core( struct lfds710_stack_state *ss,
10                                                        void *user_state )
11 {
12   LFDS710_PAL_ASSERT( ss != NULL );
13   LFDS710_PAL_ASSERT( (lfds710_pal_uint_t) ss->top % LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
14   LFDS710_PAL_ASSERT( (lfds710_pal_uint_t) &ss->user_state % LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES == 0 );
15   // TRD : user_state can be NULL
16
17   ss->top[POINTER] = NULL;
18   ss->top[COUNTER] = 0;
19
20   ss->user_state = user_state;
21
22   lfds710_misc_internal_backoff_init( &ss->pop_backoff );
23   lfds710_misc_internal_backoff_init( &ss->push_backoff );
24
25   LFDS710_MISC_BARRIER_STORE;
26
27   lfds710_misc_force_store();
28
29   return;
30 }
31