| 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_LOCK_H ) |
| 23 |
#define _LIBCTHREADS_INTERNAL_LOCK_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_lock libcthreads_internal_lock_t; |
| 43 |
|
| 44 |
struct libcthreads_internal_lock |
| 45 |
{ |
| 46 |
#if defined( WINAPI ) |
| 47 |
|
| 48 |
|
| 49 |
CRITICAL_SECTION critical_section; |
| 50 |
|
| 51 |
#elif defined( HAVE_PTHREAD_H ) |
| 52 |
|
| 53 |
|
| 54 |
pthread_mutex_t mutex; |
| 55 |
|
| 56 |
#else |
| 57 |
#error Missing lock type |
| 58 |
#endif |
| 59 |
}; |
| 60 |
|
| 61 |
LIBCTHREADS_EXTERN \ |
| 62 |
int libcthreads_lock_initialize( |
| 63 |
libcthreads_lock_t **lock, |
| 64 |
libcerror_error_t **error ); |
| 65 |
|
| 66 |
LIBCTHREADS_EXTERN \ |
| 67 |
int libcthreads_lock_free( |
| 68 |
libcthreads_lock_t **lock, |
| 69 |
libcerror_error_t **error ); |
| 70 |
|
| 71 |
LIBCTHREADS_EXTERN \ |
| 72 |
int libcthreads_lock_grab( |
| 73 |
const libcthreads_lock_t *lock, |
| 74 |
libcerror_error_t **error ); |
| 75 |
|
| 76 |
LIBCTHREADS_EXTERN \ |
| 77 |
int libcthreads_lock_release( |
| 78 |
const libcthreads_lock_t *lock, |
| 79 |
libcerror_error_t **error ); |
| 80 |
|
| 81 |
#endif |
| 82 |
|
| 83 |
#if defined( __cplusplus ) |
| 84 |
} |
| 85 |
#endif |
| 86 |
|
| 87 |
#endif |
| 88 |
|