]> pd.if.org Git - liblfds/blob - liblfds/liblfds7.0.0/test/src/util_thread_starter.h
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds7.0.0 / test / src / util_thread_starter.h
1 /***** structs *****/
2 struct util_thread_starter_thread_state
3 {
4   // TRD : must be volatile or the compiler optimizes it away into a single load
5   enum flag volatile
6     thread_ready_flag,
7     *thread_start_flag;
8
9   void
10     *thread_user_state;
11 };
12
13 struct util_thread_starter_state
14 {
15   enum flag volatile
16     thread_start_flag;
17
18   lfds700_pal_uint_t
19     number_thread_states;
20
21   struct util_thread_starter_thread_state
22     *tsts;
23 };
24
25 /***** prototypes *****/
26 void util_thread_starter_new( struct util_thread_starter_state **tts, lfds700_pal_uint_t number_threads );
27 void util_thread_starter_start( struct util_thread_starter_state *tts,
28                                 test_pal_thread_state_t *thread_state,
29                                 lfds700_pal_uint_t thread_number,
30                                 struct test_pal_logical_processor *lp, 
31                                 test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)( void *thread_user_state ),
32                                 void *thread_user_state );
33 void util_thread_starter_ready_and_wait( struct util_thread_starter_thread_state *tsts );
34 void util_thread_starter_run( struct util_thread_starter_state *tts );
35 void util_thread_starter_delete( struct util_thread_starter_state *tts );
36
37 void util_thread_start_wrapper( test_pal_thread_state_t *thread_state,
38                                 struct test_pal_logical_processor *lp,
39                                 test_pal_thread_return_t (TEST_PAL_CALLING_CONVENTION *thread_function)(void *thread_user_state),
40                                 void *thread_user_state );
41