00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef AXIS2_THREAD_POOL_H
00018 #define AXIS2_THREAD_POOL_H
00019
00025 #include <axis2_utils_defines.h>
00026 #include <axis2_allocator.h>
00027 #include <axis2_thread.h>
00028
00029 #ifdef __cplusplus
00030 extern "C"
00031 {
00032 #endif
00033
00040 typedef struct axis2_thread_pool_ops axis2_thread_pool_ops_t;
00041 typedef struct axis2_thread_pool axis2_thread_pool_t;
00042 struct axis2_env;
00043
00049 AXIS2_DECLARE_DATA struct axis2_thread_pool_ops
00050 {
00057 axis2_thread_t * (AXIS2_CALL *
00058 get_thread) (axis2_thread_pool_t *pool,
00059 axis2_thread_start_t func,
00060 void *data);
00066 axis2_status_t (AXIS2_CALL *
00067 join_thread) (axis2_thread_pool_t *pool,
00068 axis2_thread_t *thd);
00074 axis2_status_t (AXIS2_CALL *
00075 exit_thread) (axis2_thread_pool_t *pool,
00076 axis2_thread_t *thd);
00082 axis2_status_t (AXIS2_CALL *
00083 thread_detach) (axis2_thread_pool_t *pool,
00084 axis2_thread_t *thd);
00089 axis2_status_t (AXIS2_CALL *
00090 free) (axis2_thread_pool_t *pool);
00091 };
00092
00097 AXIS2_DECLARE_DATA struct axis2_thread_pool
00098 {
00099 axis2_thread_pool_ops_t *ops;
00100 };
00106 AXIS2_EXTERN axis2_thread_pool_t * AXIS2_CALL axis2_thread_pool_init(
00107 axis2_allocator_t *allocator);
00108
00113 AXIS2_EXTERN struct axis2_env * AXIS2_CALL
00114 axis2_init_thread_env(const struct axis2_env *system_env);
00115
00116 #define AXIS2_THREAD_POOL_GET_THREAD(thread_pool, func, data) \
00117 ((thread_pool)->ops->get_thread(thread_pool, func, data))
00118
00119 #define AXIS2_THREAD_POOL_JOIN_THREAD(thread_pool, thd) \
00120 ((thread_pool)->ops->join_thread(thread_pool, thd))
00121
00122 #define AXIS2_THREAD_POOL_EXIT_THREAD(thread_pool, thd) \
00123 ((thread_pool)->ops->exit_thread(thread_pool, thd))
00124
00125 #define AXIS2_THREAD_POOL_THREAD_DETACH(thread_pool, thd) \
00126 ((thread_pool)->ops->thread_detach(thread_pool, thd))
00127
00128 #define AXIS2_THREAD_POOL_FREE(thread_pool) \
00129 ((thread_pool)->ops->free(thread_pool))
00130
00133 #ifdef __cplusplus
00134 }
00135 #endif
00136
00137 #endif