summaryrefslogtreecommitdiff
path: root/locking.h
diff options
context:
space:
mode:
Diffstat (limited to 'locking.h')
-rw-r--r--locking.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/locking.h b/locking.h
index 51034b3..cb57a9d 100644
--- a/locking.h
+++ b/locking.h
@@ -15,6 +15,11 @@ struct rwlock {
pthread_rwlock_t lock;
};
+struct condlock {
+ pthread_mutex_t lock;
+ pthread_cond_t cond;
+};
+
static inline int spinlock_init(struct spinlock *l)
{
return -pthread_spin_init(&l->lock, 0);
@@ -86,4 +91,30 @@ static inline void rwlock_unlock(struct rwlock *l)
pthread_rwlock_unlock(&l->lock);
}
+static inline void condlock_init(struct condlock *c)
+{
+ pthread_mutex_init(&c->lock, NULL);
+ pthread_cond_init(&c->cond, NULL);
+}
+
+static inline void condlock_signal(struct condlock *c)
+{
+ pthread_mutex_lock(&c->lock);
+ pthread_cond_signal(&c->cond);
+ pthread_mutex_unlock(&c->lock);
+}
+
+static inline void condlock_wait(struct condlock *c)
+{
+ pthread_mutex_lock(&c->lock);
+ pthread_cond_wait(&c->cond, &c->lock);
+ pthread_mutex_unlock(&c->lock);
+}
+
+static inline void condlock_destroy(struct condlock *c)
+{
+ pthread_mutex_destroy(&c->lock);
+ pthread_cond_destroy(&c->cond);
+}
+
#endif /* LOCKING_H */
add a script to check if Documentation/00-INDEX is sane Docs: change sh -> awk in REPORTING-BUGS Documentation/core-api/device_link: Add initial documentation core-api: remove an unexpected unident ppc/idle: Add documentation for powersave=off Doc: Correct typo, "Introdution" => "Introduction" Documentation/atomic_ops.txt: convert to ReST markup Documentation/local_ops.txt: convert to ReST markup Documentation/assoc_array.txt: convert to ReST markup docs-rst: parse-headers.pl: cleanup the documentation docs-rst: fix media cleandocs target docs-rst: media/Makefile: reorganize the rules docs-rst: media: build SVG from graphviz files docs-rst: replace bayer.png by a SVG image ...
Diffstat (limited to 'fs/f2fs/xattr.h')