- Main Page
- Modules
- Classes
- Files
- Directories
- Related Pages
- Examples

- Search for |

# axutil_thread.h

Go to the documentation of this file.

    00001
    00002 /*
    00003  * Licensed to the Apache Software Foundation (ASF) under one or more
    00004  * contributor license agreements.  See the NOTICE file distributed with
    00005  * this work for additional information regarding copyright ownership.
    00006  * The ASF licenses this file to You under the Apache License, Version 2.0
    00007  * (the "License"); you may not use this file except in compliance with
    00008  * the License.  You may obtain a copy of the License at
    00009  *
    00010  *      http://www.apache.org/licenses/LICENSE-2.0
    00011  *
    00012  * Unless required by applicable law or agreed to in writing, software
    00013  * distributed under the License is distributed on an "AS IS" BASIS,
    00014  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00015  * See the License for the specific language governing permissions and
    00016  * limitations under the License.
    00017  */
    00018
    00019 #ifndef AXUTIL_THREAD_H
    00020 #define AXUTIL_THREAD_H
    00021
    00027 #include <axutil_allocator.h>
    00028 #include <axutil_utils_defines.h>
    00029 #include <axutil_error.h>
    00030
    00031 #ifdef __cplusplus
    00032 extern "C"
    00033 {
    00034 #endif
    00035
    00046     /*#define AXIS2_THREAD_FUNC */
    00047
    00049     typedef struct axutil_thread_t axutil_thread_t;
    00050
    00052     typedef struct axutil_threadattr_t axutil_threadattr_t;
    00053
    00055     typedef struct axutil_thread_once_t axutil_thread_once_t;
    00056
    00060     typedef void *(
    00061         AXIS2_THREAD_FUNC * axutil_thread_start_t)(
    00062             axutil_thread_t *,
    00063             void *);
    00064
    00066     typedef struct axutil_threadkey_t axutil_threadkey_t;
    00067
    00068     /* Thread Function definitions */
    00069
    00075     AXIS2_EXTERN axutil_threadattr_t *AXIS2_CALL
    00076     axutil_threadattr_create(
    00077         axutil_allocator_t * allocator);
    00078
    00085     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00086     axutil_threadattr_detach_set(
    00087         axutil_threadattr_t * attr,
    00088         axis2_bool_t detached);
    00089
    00096     AXIS2_EXTERN axis2_bool_t AXIS2_CALL
    00097     axutil_threadattr_is_detach(
    00098         axutil_threadattr_t * attr,
    00099         axutil_allocator_t * allocator);
    00100
    00109     AXIS2_EXTERN axutil_thread_t *AXIS2_CALL
    00110     axutil_thread_create(
    00111         axutil_allocator_t * allocator,
    00112         axutil_threadattr_t * attr,
    00113         axutil_thread_start_t func,
    00114         void *data);
    00115
    00121     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00122     axutil_thread_exit(
    00123         axutil_thread_t * thd,
    00124         axutil_allocator_t * allocator);
    00125
    00131     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00132     axutil_thread_join(
    00133         axutil_thread_t * thd);
    00134
    00138     AXIS2_EXTERN void AXIS2_CALL
    00139     axutil_thread_yield(void
    00140     );
    00141
    00147     AXIS2_EXTERN axutil_thread_once_t *AXIS2_CALL
    00148     axutil_thread_once_init(
    00149         axutil_allocator_t * allocator);
    00150
    00161     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00162     axutil_thread_once(
    00163         axutil_thread_once_t * control,
    00164         void(*func)(void));
    00165
    00171     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00172     axutil_thread_detach(
    00173         axutil_thread_t * thd);
    00174
    00175
    00176     /*************************Thread locking functions*****************************/
    00177
    00179     typedef struct axutil_thread_mutex_t axutil_thread_mutex_t;
    00180
    00181 #define AXIS2_THREAD_MUTEX_DEFAULT  0x0
    00183 #define AXIS2_THREAD_MUTEX_NESTED   0x1
    00185 #define AXIS2_THREAD_MUTEX_UNNESTED 0x2
    00194     AXIS2_EXTERN axutil_thread_mutex_t *AXIS2_CALL
    00195
    00196     axutil_thread_mutex_create(
    00197         axutil_allocator_t * allocator,
    00198         unsigned int flags);
    00199
    00205     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00206     axutil_thread_mutex_lock(
    00207         axutil_thread_mutex_t * mutex);
    00208
    00214     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00215     axutil_thread_mutex_trylock(
    00216         axutil_thread_mutex_t * mutex);
    00217
    00222     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00223     axutil_thread_mutex_unlock(
    00224         axutil_thread_mutex_t * mutex);
    00225
    00230     AXIS2_EXTERN axis2_status_t AXIS2_CALL
    00231     axutil_thread_mutex_destroy(
    00232         axutil_thread_mutex_t * mutex);
    00233
    00235 #ifdef __cplusplus
    00236 }
    00237 #endif
    00238
    00239 #endif                          /* AXIS2_THREAD_H */