[Pvfs2-cvs] commit by slang in pvfs2/src/common/gen-locks: gen-locks.c gen-locks.h

CVS commit program cvs at parl.clemson.edu
Tue Jul 29 18:48:54 EDT 2008


Update of /projects/cvsroot/pvfs2/src/common/gen-locks
In directory parlweb1:/tmp/cvs-serv10031/src/common/gen-locks

Modified Files:
      Tag: directio-branch
	gen-locks.c gen-locks.h 
Log Message:
adding threaded odirect impl


Index: gen-locks.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/gen-locks/gen-locks.c,v
diff -p -u -r1.10 -r1.10.16.1
--- gen-locks.c	24 Jul 2007 18:52:20 -0000	1.10
+++ gen-locks.c	29 Jul 2008 22:48:54 -0000	1.10.16.1
@@ -77,7 +77,7 @@ int gen_posix_mutex_trylock(
 /*
  * gen_mutex_destroy()
  *
- * uninitializes the mutex.
+ * uninitializes the mutex and frees all memory associated with it.
  *
  * returns 0 on success, -errno on failure.
  */
@@ -97,6 +97,43 @@ int gen_posix_mutex_destroy(
 pthread_t gen_posix_thread_self(void)
 {
     return pthread_self();
+}
+
+int gen_posix_cond_destroy(pthread_cond_t *cond)
+{
+    if(!cond)
+    {
+        return -EINVAL;
+    }
+    pthread_cond_destroy(cond);
+    free(cond);
+    return 0;
+}
+
+int gen_posix_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mut)
+{
+    return pthread_cond_wait(cond, mut);
+}
+
+int gen_posix_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mut,
+                             const struct timespec *abstime)
+{
+    return pthread_cond_timedwait(cond, mut, abstime);
+}
+
+int gen_posix_cond_signal(pthread_cond_t *cond)
+{
+    return pthread_cond_signal(cond);
+}
+
+int gen_posix_cond_broadcast(pthread_cond_t *cond)
+{
+    return pthread_cond_broadcast(cond);
+}
+
+int gen_posix_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr)
+{
+    return pthread_cond_init(cond, attr);
 }
 
 #endif

Index: gen-locks.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/gen-locks/gen-locks.h,v
diff -p -u -r1.14 -r1.14.16.1
--- gen-locks.h	24 Jul 2007 18:52:20 -0000	1.14
+++ gen-locks.h	29 Jul 2008 22:48:54 -0000	1.14.16.1
@@ -34,20 +34,25 @@
 #include <pthread.h>
 
 	/* function prototypes for specific locking implementations */
-int gen_posix_mutex_lock(
-    pthread_mutex_t * mut);
-int gen_posix_mutex_unlock(
-    pthread_mutex_t * mut);
-int gen_posix_mutex_trylock(
-    pthread_mutex_t * mut);
-int gen_posix_mutex_destroy(
-    pthread_mutex_t * mut);
-int gen_posix_mutex_init(
-    pthread_mutex_t * mut);
+int gen_posix_mutex_lock(pthread_mutex_t * mut);
+int gen_posix_mutex_unlock(pthread_mutex_t * mut);
+int gen_posix_mutex_trylock(pthread_mutex_t * mut);
+pthread_mutex_t *gen_posix_mutex_build(void);
+int gen_posix_mutex_destroy(pthread_mutex_t * mut);
+int gen_posix_mutex_init(pthread_mutex_t * mut);
 pthread_t gen_posix_thread_self(void);
 
+int gen_posix_cond_init(pthread_cond_t *cond, pthread_condattr_t *attr);
+int gen_posix_cond_destroy(pthread_cond_t *cond);
+int gen_posix_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mut);
+int gen_posix_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mut,
+                             const struct timespec *abstime);
+int gen_posix_cond_signal(pthread_cond_t *cond);
+int gen_posix_cond_broadcast(pthread_cond_t *cond);
+
 typedef pthread_mutex_t gen_mutex_t;
 typedef pthread_t       gen_thread_t;
+typedef pthread_cond_t  gen_cond_t;
 #define GEN_MUTEX_INITIALIZER PTHREAD_MUTEX_INITIALIZER;
 #define gen_mutex_lock(m) gen_posix_mutex_lock(m)
 #define gen_mutex_unlock(m) gen_posix_mutex_unlock(m)
@@ -55,6 +60,14 @@ typedef pthread_t       gen_thread_t;
 #define gen_mutex_destroy(m) gen_posix_mutex_destroy(m)
 #define gen_mutex_init(m) gen_posix_mutex_init(m)
 #define gen_thread_self() gen_posix_thread_self()
+
+#define gen_cond_init(c) gen_posix_cond_init(c, NULL)
+#define gen_cond_destroy(c) gen_posix_cond_destroy(c)
+#define gen_cond_wait(c, m) gen_posix_cond_wait(c, m)
+#define gen_cond_timedwait(c, m, s) gen_posix_cond_timedwait(c, m, s)
+#define gen_cond_signal(c) gen_posix_cond_signal(c)
+#define gen_cond_broadcast(c) gen_posix_cond_broadcast(c)
+
 #endif /* __GEN_POSIX_LOCKING__ */
 
 
@@ -62,6 +75,8 @@ typedef pthread_t       gen_thread_t;
 	/* this stuff messes around just enough to prevent warnings */
 typedef int gen_mutex_t;
 typedef unsigned long gen_thread_t;
+typedef int gen_cond_t;
+
 #define GEN_MUTEX_INITIALIZER 0
 static inline int gen_mutex_lock(
     gen_mutex_t * mutex_p)
@@ -87,6 +102,35 @@ static inline gen_thread_t gen_thread_se
 }
 #define gen_mutex_init(m) do{}while(0)
 #define gen_mutex_destroy(m) do{}while(0)
+
+#define gen_cond_init(c) do{}while(0)
+#define gen_cond_destroy(c) do{}while(0)
+
+static inline int gen_cond_wait(gen_cond_t *cond, gen_mutex_t *mut)
+{
+    (void *)cond;
+    return 0;
+}
+
+static inline int gen_cond_timedwait(gen_cond_t *cond, gen_mutex_t *mut,
+                                     const struct timespec *abstime)
+{
+    (void *)cond;
+    return 0;
+}
+
+static inline int gen_cond_signal(gen_cond_t *cond)
+{
+    (void *)cond;
+    return 0;
+}
+
+static inline int gen_cond_broadcast(gen_cond_t *cond)
+{
+    (void *)cond;
+    return 0;
+}
+
 #endif /* __GEN_NULL_LOCKING__ */
 
 #endif /* __GEN_LOCKS_H */



More information about the Pvfs2-cvs mailing list