axis2_thread_pool.h

Go to the documentation of this file.
00001 /*
00002  * Licensed to the Apache Software Foundation (ASF) under one or more
00003  * contributor license agreements.  See the NOTICE file distributed with
00004  * this work for additional information regarding copyright ownership.
00005  * The ASF licenses this file to You under the Apache License, Version 2.0
00006  * (the "License"); you may not use this file except in compliance with
00007  * the License.  You may obtain a copy of the License at
00008  *
00009  *      http://www.apache.org/licenses/LICENSE-2.0
00010  *
00011  * Unless required by applicable law or agreed to in writing, software
00012  * distributed under the License is distributed on an "AS IS" BASIS,
00013  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  * See the License for the specific language governing permissions and
00015  * limitations under the License.
00016  */
00017 
00018 #ifndef AXIS2_THREAD_POOL_H
00019 #define AXIS2_THREAD_POOL_H
00020 
00026 #include <axis2_utils_defines.h>
00027 #include <axis2_allocator.h>
00028 #include <axis2_thread.h>
00029 
00030 #ifdef __cplusplus
00031 extern "C"
00032 {
00033 #endif
00034 
00041 typedef struct axis2_thread_pool_ops axis2_thread_pool_ops_t;
00042 typedef struct axis2_thread_pool axis2_thread_pool_t;
00043 struct axis2_env;
00044 
00050  struct axis2_thread_pool_ops
00051 {
00058    axis2_thread_t * (AXIS2_CALL *
00059    get_thread) (axis2_thread_pool_t *pool, 
00060              axis2_thread_start_t func, 
00061                  void *data);
00067    axis2_status_t (AXIS2_CALL *
00068    join_thread) (axis2_thread_pool_t *pool, 
00069               axis2_thread_t *thd);
00075    axis2_status_t (AXIS2_CALL *
00076    exit_thread) (axis2_thread_pool_t *pool, 
00077               axis2_thread_t *thd);
00083    axis2_status_t (AXIS2_CALL *
00084    thread_detach) (axis2_thread_pool_t *pool, 
00085                axis2_thread_t *thd);
00090    axis2_status_t (AXIS2_CALL *
00091    free) (axis2_thread_pool_t *pool);
00092 };
00093 
00098  struct axis2_thread_pool
00099 {
00100    axis2_thread_pool_ops_t *ops;
00101 };
00107 AXIS2_EXTERN axis2_thread_pool_t * AXIS2_CALL axis2_thread_pool_init(
00108                axis2_allocator_t *allocator);
00109 
00114 AXIS2_EXTERN struct axis2_env * AXIS2_CALL
00115 axis2_init_thread_env(const struct axis2_env *system_env);
00116 
00121 AXIS2_EXTERN void AXIS2_CALL
00122 axis2_free_thread_env(struct axis2_env *thread_env);
00123 
00124 #define AXIS2_THREAD_POOL_GET_THREAD(thread_pool, func, data) \
00125       ((thread_pool)->ops->get_thread(thread_pool, func, data))
00126 
00127 #define AXIS2_THREAD_POOL_JOIN_THREAD(thread_pool, thd) \
00128       ((thread_pool)->ops->join_thread(thread_pool, thd))
00129 
00130 #define AXIS2_THREAD_POOL_EXIT_THREAD(thread_pool, thd) \
00131       ((thread_pool)->ops->exit_thread(thread_pool, thd))
00132 
00133 #define AXIS2_THREAD_POOL_THREAD_DETACH(thread_pool, thd) \
00134       ((thread_pool)->ops->thread_detach(thread_pool, thd))
00135 
00136 #define AXIS2_THREAD_POOL_FREE(thread_pool) \
00137       ((thread_pool)->ops->free(thread_pool))
00138 
00141 #ifdef __cplusplus
00142 }
00143 #endif
00144 
00145 #endif    /* AXIS2_THREAD_POOL_H */

Generated on Wed Dec 20 20:14:10 2006 for Axis2/C by  doxygen 1.5.1