]> pd.if.org Git - liblfds/blob - liblfds/liblfds6.1.1/test/src/abstraction.h
Initial import (all versions, including the new 7.1.0)
[liblfds] / liblfds / liblfds6.1.1 / test / src / abstraction.h
1 /***** defines *****/\r
2 #if (defined _WIN32 && defined _MSC_VER && !defined WIN_KERNEL_BUILD)\r
3   /* TRD : any Windows (user-mode) on any CPU with the Microsoft C compiler\r
4 \r
5            _WIN32             indicates 64-bit or 32-bit Windows\r
6            _MSC_VER           indicates Microsoft C compiler\r
7            !WIN_KERNEL_BUILD  indicates Windows user-mode\r
8   */\r
9 \r
10   #include <windows.h>\r
11   typedef HANDLE              thread_state_t;\r
12   typedef DWORD               thread_return_t;\r
13   #define CALLING_CONVENTION  WINAPI\r
14 #endif\r
15 \r
16 #if (defined _WIN32 && defined _MSC_VER && defined WIN_KERNEL_BUILD)\r
17   /* TRD : any Windows (kernel-mode) on any CPU with the Microsoft C compiler\r
18 \r
19            _WIN32            indicates 64-bit or 32-bit Windows\r
20            _MSC_VER          indicates Microsoft C compiler\r
21            WIN_KERNEL_BUILD  indicates Windows kernel\r
22   */\r
23 \r
24   #include <wdm.h>\r
25   typedef HANDLE              thread_state_t;\r
26   typedef VOID                thread_return_t;\r
27   #define CALLING_CONVENTION  \r
28 #endif\r
29 \r
30 #if (defined __unix__ && defined __GNUC__)\r
31   /* TRD : any UNIX on any CPU with GCC\r
32 \r
33            __unix__   indicates Solaris, Linux, HPUX, etc\r
34            __GNUC__   indicates GCC\r
35   */\r
36   #include <unistd.h>\r
37   #include <pthread.h>\r
38   #include <sched.h>\r
39   typedef pthread_t           thread_state_t;\r
40   typedef void *              thread_return_t;\r
41   #define CALLING_CONVENTION  \r
42 #endif\r
43 \r
44 typedef thread_return_t (CALLING_CONVENTION *thread_function_t)( void *thread_user_state );\r
45 \r
46 /***** public prototypes *****/\r
47 unsigned int abstraction_cpu_count( void );\r
48 int abstraction_thread_start( thread_state_t *thread_state, unsigned int cpu, thread_function_t thread_function, void *thread_user_state );\r
49 void abstraction_thread_wait( thread_state_t thread_state );\r
50 \r