| 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_QUEUE_H ) |
| 23 |
#define _LIBCTHREADS_INTERNAL_QUEUE_H |
| 24 |
|
| 25 |
#include <common.h> |
| 26 |
#include <types.h> |
| 27 |
|
| 28 |
#include "libcthreads_extern.h" |
| 29 |
#include "libcthreads_libcerror.h" |
| 30 |
#include "libcthreads_types.h" |
| 31 |
|
| 32 |
#if defined( __cplusplus ) |
| 33 |
extern "C" { |
| 34 |
#endif |
| 35 |
|
| 36 |
#if !defined( HAVE_LOCAL_LIBCTHREADS ) || defined( HAVE_MULTI_THREAD_SUPPORT ) |
| 37 |
|
| 38 |
typedef struct libcthreads_internal_queue libcthreads_internal_queue_t; |
| 39 |
|
| 40 |
struct libcthreads_internal_queue |
| 41 |
{ |
| 42 |
|
| 43 |
|
| 44 |
int pop_index; |
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
int push_index; |
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
int number_of_values; |
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
int allocated_number_of_values; |
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
intptr_t **values_array; |
| 61 |
|
| 62 |
|
| 63 |
|
| 64 |
libcthreads_mutex_t *condition_mutex; |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
libcthreads_condition_t *empty_condition; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
libcthreads_condition_t *full_condition; |
| 73 |
}; |
| 74 |
|
| 75 |
LIBCTHREADS_EXTERN \ |
| 76 |
int libcthreads_queue_initialize( |
| 77 |
libcthreads_queue_t **queue, |
| 78 |
int maximum_number_of_values, |
| 79 |
libcerror_error_t **error ); |
| 80 |
|
| 81 |
LIBCTHREADS_EXTERN \ |
| 82 |
int libcthreads_queue_free( |
| 83 |
libcthreads_queue_t **queue, |
| 84 |
int (*value_free_function)( |
| 85 |
intptr_t **value, |
| 86 |
libcerror_error_t **error ), |
| 87 |
libcerror_error_t **error ); |
| 88 |
|
| 89 |
LIBCTHREADS_EXTERN \ |
| 90 |
int libcthreads_queue_empty( |
| 91 |
libcthreads_queue_t *queue, |
| 92 |
libcerror_error_t **error ); |
| 93 |
|
| 94 |
LIBCTHREADS_EXTERN \ |
| 95 |
int libcthreads_queue_try_pop( |
| 96 |
libcthreads_queue_t *queue, |
| 97 |
intptr_t **value, |
| 98 |
libcerror_error_t **error ); |
| 99 |
|
| 100 |
LIBCTHREADS_EXTERN \ |
| 101 |
int libcthreads_queue_pop( |
| 102 |
libcthreads_queue_t *queue, |
| 103 |
intptr_t **value, |
| 104 |
libcerror_error_t **error ); |
| 105 |
|
| 106 |
LIBCTHREADS_EXTERN \ |
| 107 |
int libcthreads_queue_try_push( |
| 108 |
libcthreads_queue_t *queue, |
| 109 |
intptr_t *value, |
| 110 |
libcerror_error_t **error ); |
| 111 |
|
| 112 |
LIBCTHREADS_EXTERN \ |
| 113 |
int libcthreads_queue_push( |
| 114 |
libcthreads_queue_t *queue, |
| 115 |
intptr_t *value, |
| 116 |
libcerror_error_t **error ); |
| 117 |
|
| 118 |
LIBCTHREADS_EXTERN \ |
| 119 |
int libcthreads_queue_push_sorted( |
| 120 |
libcthreads_queue_t *queue, |
| 121 |
intptr_t *value, |
| 122 |
int (*value_compare_function)( |
| 123 |
intptr_t *first_value, |
| 124 |
intptr_t *second_value, |
| 125 |
libcerror_error_t **error ), |
| 126 |
uint8_t sort_flags, |
| 127 |
libcerror_error_t **error ); |
| 128 |
|
| 129 |
#endif |
| 130 |
|
| 131 |
#if defined( __cplusplus ) |
| 132 |
} |
| 133 |
#endif |
| 134 |
|
| 135 |
#endif |
| 136 |
|