| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
#if !defined( _LIBCTHREADS_INTERNAL_REPEATING_THREAD_H ) |
| 23 |
#define _LIBCTHREADS_INTERNAL_REPEATING_THREAD_H |
| 24 |
|
| 25 |
#include <common.h> |
| 26 |
#include <types.h> |
| 27 |
|
| 28 |
#if defined( HAVE_PTHREAD_H ) && !defined( WINAPI ) |
| 29 |
#include <pthread.h> |
| 30 |
#endif |
| 31 |
|
| 32 |
#include "libcthreads_extern.h" |
| 33 |
#include "libcthreads_libcerror.h" |
| 34 |
#include "libcthreads_types.h" |
| 35 |
|
| 36 |
#if defined( __cplusplus ) |
| 37 |
extern "C" { |
| 38 |
#endif |
| 39 |
|
| 40 |
#if !defined( HAVE_LOCAL_LIBCTHREADS ) || defined( HAVE_MULTI_THREAD_SUPPORT ) |
| 41 |
|
| 42 |
typedef struct libcthreads_internal_repeating_thread libcthreads_internal_repeating_thread_t; |
| 43 |
|
| 44 |
struct libcthreads_internal_repeating_thread |
| 45 |
{ |
| 46 |
#if defined( WINAPI ) |
| 47 |
|
| 48 |
|
| 49 |
HANDLE thread_handle; |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
DWORD thread_identifier; |
| 54 |
|
| 55 |
#elif defined( HAVE_PTHREAD_H ) |
| 56 |
|
| 57 |
|
| 58 |
pthread_t thread; |
| 59 |
#else |
| 60 |
#error Missing thread type |
| 61 |
#endif |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
int (*start_function)( |
| 66 |
void *arguments ); |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
void *start_function_arguments; |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
int start_function_result; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
libcthreads_mutex_t *condition_mutex; |
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
libcthreads_condition_t *status_condition; |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
uint8_t status; |
| 87 |
}; |
| 88 |
|
| 89 |
LIBCTHREADS_EXTERN \ |
| 90 |
int libcthreads_repeating_thread_create( |
| 91 |
libcthreads_repeating_thread_t **repeating_thread, |
| 92 |
const libcthreads_thread_attributes_t *thread_attributes, |
| 93 |
int (*start_function)( |
| 94 |
void *arguments ), |
| 95 |
void *start_function_arguments, |
| 96 |
libcerror_error_t **error ); |
| 97 |
|
| 98 |
LIBCTHREADS_EXTERN \ |
| 99 |
int libcthreads_repeating_thread_push( |
| 100 |
libcthreads_repeating_thread_t *repeating_thread, |
| 101 |
libcerror_error_t **error ); |
| 102 |
|
| 103 |
LIBCTHREADS_EXTERN \ |
| 104 |
int libcthreads_repeating_thread_join( |
| 105 |
libcthreads_repeating_thread_t **repeating_thread, |
| 106 |
libcerror_error_t **error ); |
| 107 |
|
| 108 |
#endif |
| 109 |
|
| 110 |
#if defined( __cplusplus ) |
| 111 |
} |
| 112 |
#endif |
| 113 |
|
| 114 |
#endif |
| 115 |
|