Grid Community Toolkit  6.2.1653033972 (tag: v6.2.20220524)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
globus_thread_rw_mutex.h
1 /*
2  * Copyright 1999-2006 University of Chicago
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 #ifndef GLOBUS_THREAD_RW_MUTEX_H
19 #define GLOBUS_THREAD_RW_MUTEX_H 1
20 
21 #include "globus_common_include.h"
22 #include "globus_thread.h"
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 typedef struct
29 {
30  globus_mutex_t mutex;
31  struct globus_i_rw_mutex_waiter_s * waiters;
32  struct globus_i_rw_mutex_waiter_s ** tail;
33  struct globus_i_rw_mutex_waiter_s * idle;
34  globus_bool_t writing;
35  int readers;
36 } globus_rw_mutex_t;
37 
38 typedef int globus_rw_mutexattr_t;
39 
40 int
41 globus_rw_mutex_init(
42  globus_rw_mutex_t * rw_lock,
43  globus_rw_mutexattr_t * attr);
44 
45 int
46 globus_rw_mutex_readlock(
47  globus_rw_mutex_t * rw_lock);
48 
49 int
50 globus_rw_mutex_writelock(
51  globus_rw_mutex_t * rw_lock);
52 
53 int
54 globus_rw_mutex_readunlock(
55  globus_rw_mutex_t * rw_lock);
56 
57 int
58 globus_rw_mutex_writeunlock(
59  globus_rw_mutex_t * rw_lock);
60 
61 int
62 globus_rw_mutex_destroy(
63  globus_rw_mutex_t * rw_lock);
64 
75 int
76 globus_rw_cond_wait(
77  globus_cond_t * cond,
78  globus_rw_mutex_t * rw_lock);
79 
80 int
81 globus_rw_cond_timedwait(
82  globus_cond_t * cond,
83  globus_rw_mutex_t * rw_lock,
84  globus_abstime_t * abstime);
85 
86 
87 #ifdef __cplusplus
88 }
89 #endif
90 
91 #endif /* GLOBUS_THREAD_RW_MUTEX_H */
Globus Threading Abstraction.
int globus_bool_t
Boolean type.
Definition: globus_types.h:93
Mutex.
Definition: globus_thread.h:107
Condition variable.
Definition: globus_thread.h:124
Include System Headers.