axis2_thread_pool.h

Go to the documentation of this file.
00001 /*
00002  * Copyright 2004,2005 The Apache Software Foundation.
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *      http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
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  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  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    /* AXIS2_THREAD_POOL_H */

Generated on Tue Oct 3 20:47:59 2006 for Axis2/C by  doxygen 1.4.7