]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/test_and_benchmark/libbenchmark/inc/libbenchmark/libbenchmark_datastructure_queue_umm_windows_mutex.h
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / test_and_benchmark / libbenchmark / inc / libbenchmark / libbenchmark_datastructure_queue_umm_windows_mutex.h
1 /***** defines *****/
2 #define LIBBENCHMARK_DATA_STRUCTURE_QUEUE_UMM_WINDOWS_MUTEX_GET_KEY_FROM_ELEMENT( queue_umm_element )             ( (queue_umm_element).key )
3 #define LIBBENCHMARK_DATA_STRUCTURE_QUEUE_UMM_WINDOWS_MUTEX_SET_KEY_IN_ELEMENT( queue_umm_element, new_key )      ( (queue_umm_element).key = (void *) (lfds710_pal_uint_t) (new_key) )
4 #define LIBBENCHMARK_DATA_STRUCTURE_QUEUE_UMM_WINDOWS_MUTEX_GET_VALUE_FROM_ELEMENT( queue_umm_element )           ( (queue_umm_element).value )
5 #define LIBBENCHMARK_DATA_STRUCTURE_QUEUE_UMM_WINDOWS_MUTEX_SET_VALUE_IN_ELEMENT( queue_umm_element, new_value )  ( (queue_umm_element).value = (void *) (lfds710_pal_uint_t) (new_value) )
6 #define LIBBENCHMARK_DATA_STRUCTURE_QUEUE_UMM_WINDOWS_MUTEX_GET_USER_STATE_FROM_STATE( queue_umm_state )          ( (queue_umm_state).user_state )
7
8 /***** structures *****/
9 struct libbenchmark_datastructure_queue_umm_windows_mutex_element
10 {
11   struct libbenchmark_datastructure_queue_umm_windows_mutex_element
12     *next;
13
14   void
15     *key,
16     *value;
17 };
18
19 struct libbenchmark_datastructure_queue_umm_windows_mutex_state
20 {
21   /* TRD : the pointers are on separate cache lines so threads enqueuing do not
22            physically collide with thread dequeuing; this is done to be fair in
23            the benchmark to the lock-free code, which does the same
24
25            since we're not atomic, we don't need to be LFDS700_PAL_ATOMIC_ISOLATION_IN_BYTES
26            bytes apart (e.g. the ERG on ARM), only cache line length in bytes
27   */
28
29   struct libbenchmark_datastructure_queue_umm_windows_mutex_element LFDS710_PAL_ALIGN(LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES)
30     *enqueue_umm,
31     *dequeue_umm;
32
33   pal_lock_windows_mutex_state LFDS710_PAL_ALIGN(LFDS710_PAL_ATOMIC_ISOLATION_IN_BYTES)
34     lock_enqueue_umm,
35     lock_dequeue_umm;
36
37   void
38     *user_state;
39 };
40
41 /***** public prototypes *****/
42 void libbenchmark_datastructure_queue_umm_windows_mutex_init( struct libbenchmark_datastructure_queue_umm_windows_mutex_state *qs, struct libbenchmark_datastructure_queue_umm_windows_mutex_element *qe, void *user_state );
43 void libbenchmark_datastructure_queue_umm_windows_mutex_cleanup( struct libbenchmark_datastructure_queue_umm_windows_mutex_state *qs, void (*element_dequeue_umm_callback)(struct libbenchmark_datastructure_queue_umm_windows_mutex_state *qs, struct libbenchmark_datastructure_queue_umm_windows_mutex_element *qe, enum flag dummy_flag) );
44
45 void libbenchmark_datastructure_queue_umm_windows_mutex_enqueue_umm( struct libbenchmark_datastructure_queue_umm_windows_mutex_state *qs, struct libbenchmark_datastructure_queue_umm_windows_mutex_element *qe );
46 int libbenchmark_datastructure_queue_umm_windows_mutex_dequeue_umm( struct libbenchmark_datastructure_queue_umm_windows_mutex_state *qs, struct libbenchmark_datastructure_queue_umm_windows_mutex_element **qe );
47