axutil_thread.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 AXUTIL_THREAD_H
00019 #define AXUTIL_THREAD_H
00020 
00021 
00027 #include <axutil_allocator.h>
00028 #include <axutil_utils_defines.h>
00029 #include <axutil_error.h>
00030 
00031 
00032 
00033 #ifdef __cplusplus
00034 extern "C"
00035 {
00036 #endif
00037 
00048     /*#define AXIS2_THREAD_FUNC*/
00049 
00051     typedef struct axutil_thread_t           axutil_thread_t;
00052 
00054     typedef struct axutil_threadattr_t       axutil_threadattr_t;
00055 
00057     typedef struct axutil_thread_once_t      axutil_thread_once_t;
00058 
00062     typedef void *(AXIS2_THREAD_FUNC *axutil_thread_start_t)(axutil_thread_t*, void*);
00063 
00065     typedef struct axutil_threadkey_t        axutil_threadkey_t;
00066 
00067     /* Thread Function definitions */
00068 
00074     AXIS2_EXTERN axutil_threadattr_t* AXIS2_CALL
00075     axutil_threadattr_create(axutil_allocator_t *allocator);
00076 
00083     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00084     axutil_threadattr_detach_set(axutil_threadattr_t *attr, 
00085         axis2_bool_t detached);
00086 
00093     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
00094     axutil_threadattr_is_detach(axutil_threadattr_t *attr, 
00095         axutil_allocator_t *allocator);
00096 
00097 
00106     AXIS2_EXTERN axutil_thread_t* AXIS2_CALL
00107     axutil_thread_create(axutil_allocator_t *allocator, 
00108         axutil_threadattr_t *attr,
00109         axutil_thread_start_t func, void *data);
00110 
00116     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00117     axutil_thread_exit(axutil_thread_t *thd, 
00118         axutil_allocator_t *allocator);
00119 
00125     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00126     axutil_thread_join(axutil_thread_t *thd);
00127 
00131     AXIS2_EXTERN void AXIS2_CALL
00132     axutil_thread_yield();
00133 
00139     AXIS2_EXTERN axutil_thread_once_t* AXIS2_CALL
00140     axutil_thread_once_init(axutil_allocator_t *allocator);
00141 
00152     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00153     axutil_thread_once(axutil_thread_once_t *control, 
00154         void(*func)(void));
00155 
00161     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00162     axutil_thread_detach(axutil_thread_t *thd);
00163 
00164     /*************************Thread locking functions*****************************/
00165 
00167     typedef struct axutil_thread_mutex_t axutil_thread_mutex_t;
00168 
00169 #define AXIS2_THREAD_MUTEX_DEFAULT  0x0   
00170 #define AXIS2_THREAD_MUTEX_NESTED   0x1   
00171 #define AXIS2_THREAD_MUTEX_UNNESTED 0x2   
00180     AXIS2_EXTERN axutil_thread_mutex_t * AXIS2_CALL
00181     axutil_thread_mutex_create(axutil_allocator_t *allocator, 
00182         unsigned int flags);
00188     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00189     axutil_thread_mutex_lock(axutil_thread_mutex_t *mutex);
00190 
00196     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00197     axutil_thread_mutex_trylock(axutil_thread_mutex_t *mutex);
00198 
00203     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00204     axutil_thread_mutex_unlock(axutil_thread_mutex_t *mutex);
00205 
00210     AXIS2_EXTERN axis2_status_t AXIS2_CALL
00211     axutil_thread_mutex_destroy(axutil_thread_mutex_t *mutex);
00212 
00214 #ifdef __cplusplus
00215 }
00216 #endif
00217 
00218 #endif                          /* AXIS2_THREAD_H */

Generated on Thu May 3 12:31:01 2007 for Axis2/C by  doxygen 1.4.6