globus_thread_rw_mutex.h

00001 /*
00002  * Copyright 1999-2006 University of Chicago
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 
00018 #ifndef GLOBUS_THREAD_RW_MUTEX_H
00019 #define GLOBUS_THREAD_RW_MUTEX_H 1
00020 
00021 #include "globus_common_include.h"
00022 #include "globus_thread.h"
00023 
00024 #ifdef __cplusplus
00025 extern "C" {
00026 #endif
00027 
00028 typedef struct
00029 {
00030     globus_mutex_t                      mutex;
00031     struct globus_i_rw_mutex_waiter_s * waiters;
00032     struct globus_i_rw_mutex_waiter_s ** tail;
00033     struct globus_i_rw_mutex_waiter_s * idle;
00034     globus_bool_t                       writing;
00035     int                                 readers;
00036 } globus_rw_mutex_t;
00037 
00038 typedef int globus_rw_mutexattr_t;
00039 
00040 int
00041 globus_rw_mutex_init(
00042     globus_rw_mutex_t *                 rw_lock,
00043     globus_rw_mutexattr_t *             attr);
00044 
00045 int
00046 globus_rw_mutex_readlock(
00047     globus_rw_mutex_t *                 rw_lock);
00048 
00049 int
00050 globus_rw_mutex_writelock(
00051     globus_rw_mutex_t *                 rw_lock);
00052 
00053 int
00054 globus_rw_mutex_readunlock(
00055     globus_rw_mutex_t *                 rw_lock);
00056 
00057 int
00058 globus_rw_mutex_writeunlock(
00059     globus_rw_mutex_t *                 rw_lock);
00060 
00061 int
00062 globus_rw_mutex_destroy(
00063     globus_rw_mutex_t *                 rw_lock);
00064 
00075 int
00076 globus_rw_cond_wait(
00077     globus_cond_t *                     cond,
00078     globus_rw_mutex_t *                 rw_lock);
00079 
00080 int
00081 globus_rw_cond_timedwait(
00082     globus_cond_t *                     cond,
00083     globus_rw_mutex_t *                 rw_lock,
00084     globus_abstime_t *                  abstime);
00085 
00086 
00087 #ifdef __cplusplus
00088 }
00089 #endif
00090 
00091 #endif /* GLOBUS_THREAD_RW_MUTEX_H */

Generated on 17 Mar 2017 for globus_common by  doxygen 1.4.7