]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.1.0/test_and_benchmark/libtest/inc/libtest/libtest_threadset.h
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.1.0 / test_and_benchmark / libtest / inc / libtest / libtest_threadset.h
1 /***** defines *****/
2 #define LIBTEST_THREADSET_GET_USER_STATE_FROM_PER_THREAD_STATE( libtest_threadset_per_thread_state )  (libtest_threadset_per_thread_state).user_state
3 #define LIBTEST_THREADSET_SET_USER_STATE( libtest_threadtest_state, userstate )                       (libtest_threadtest_state).user_state = userstate
4
5 /***** structs *****/
6 struct libtest_threadset_per_thread_state
7 {
8   enum flag volatile
9     thread_ready_flag,
10     *threadset_start_flag;
11
12   libshared_pal_thread_handle_t
13     thread_handle;
14
15   struct lfds710_list_asu_element
16     lasue;
17
18   struct libshared_pal_thread_info
19     pti;
20
21   struct libtest_threadset_state
22     *ts;
23
24   void
25     *user_state;
26 };
27
28 struct libtest_threadset_state
29 {
30   enum flag volatile
31     threadset_start_flag;
32
33   struct lfds710_list_asu_state
34     list_of_per_thread_states;
35
36   struct libshared_memory_state
37     *ms;
38
39   void
40     *user_state;
41 };
42
43 /***** prototypes *****/
44 void libtest_threadset_init( struct libtest_threadset_state *ts,
45                              void *user_state );
46 void libtest_threadset_cleanup( struct libtest_threadset_state *ts );
47
48 void libtest_threadset_add_thread( struct libtest_threadset_state *ts,
49                                    struct libtest_threadset_per_thread_state *pts,
50                                    struct libtest_logical_processor *lp,
51                                    libshared_pal_thread_return_t (LIBSHARED_PAL_THREAD_CALLING_CONVENTION *thread_function)( void *thread_user_state ),
52                                    void *user_state );
53
54 void libtest_threadset_run( struct libtest_threadset_state *ts );
55 void libtest_threadset_thread_ready_and_wait( struct libtest_threadset_per_thread_state *pts );
56