[Pvfs2-cvs] commit by kunkel in pvfs2/src/common/gen-locks:
gen-locks.h gen-locks.c
CVS commit program
cvs at parl.clemson.edu
Fri Feb 23 09:17:10 EST 2007
Update of /projects/cvsroot/pvfs2/src/common/gen-locks
In directory parlweb1:/tmp/cvs-serv18345/src/common/gen-locks
Modified Files:
Tag: kunkel-migration-branch
gen-locks.h gen-locks.c
Log Message:
There might be a bug in the pthread implementation for our Intel Xeon SMP machine which randomly results in a server crash by the fault: pthread_mutex_lock.c:78: __pthread_mutex_lock: Assertion
`mutex->__data.__owner == 0' failed on high frequents of mutex lock and unlock operations,
so I will use semaphores which avoids the problem.
Index: gen-locks.h
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/gen-locks/gen-locks.h,v
diff -p -u -r1.10.42.1 -r1.10.42.2
--- gen-locks.h 17 Feb 2007 11:17:00 -0000 1.10.42.1
+++ gen-locks.h 23 Feb 2007 14:17:10 -0000 1.10.42.2
@@ -13,7 +13,7 @@
* int gen_mutex_unlock(gen_mutex_t* mut);
* int gen_mutex_trylock(gen_mutex_t* mut);
* gen_mutex_t* gen_mutex_build(void);
- * int gen_mutex_destroy(gen_mutex_t* mut);
+ * int gen_mutex_destroy(gen_mutex_t* mut);
*
* See the examples directory for details.
*/
@@ -25,7 +25,7 @@
/* we will make posix locks the default unless turned off for now. */
/* this is especially important for development in which case the locks
- * should really be enabled in order to verify proper operation
+ * should really be enabled in order to verify proper operation
*/
#if !defined(__GEN_NULL_LOCKING__) && !defined(__GEN_POSIX_LOCKING__)
#define __GEN_POSIX_LOCKING__
@@ -33,6 +33,23 @@
#ifdef __GEN_POSIX_LOCKING__
#include <pthread.h>
+
+/* somehow I get sometimes cool messages like:
+ * pthread_mutex_lock.c __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0'
+ * now I try with semaphores
+ * */
+#include <semaphore.h>
+typedef sem_t gen_sem_t;
+
+
+int gen_posix_sem_init(
+ gen_sem_t * sem);
+int gen_posix_sem_destroy(
+ gen_sem_t * sem);
+int gen_posix_sem_lock(
+ gen_sem_t * sem);
+int gen_posix_sem_unlock(
+ gen_sem_t * sem);
/* function prototypes for specific locking implementations */
int gen_posix_mutex_lock(
Index: gen-locks.c
===================================================================
RCS file: /projects/cvsroot/pvfs2/src/common/gen-locks/gen-locks.c,v
diff -p -u -r1.7.40.1 -r1.7.40.2
--- gen-locks.c 17 Feb 2007 11:17:00 -0000 1.7.40.1
+++ gen-locks.c 23 Feb 2007 14:17:10 -0000 1.7.40.2
@@ -19,6 +19,32 @@
*/
#ifndef __GEN_NULL_LOCKING__
+
+int gen_posix_sem_destroy(
+ gen_sem_t * sem)
+{
+ return sem_destroy(sem);
+}
+
+int gen_posix_sem_init(
+ gen_sem_t * sem)
+{
+ return sem_init(sem, 0, 1);
+}
+
+
+int gen_posix_sem_lock(
+ gen_sem_t * sem)
+{
+ return sem_wait(sem);
+}
+
+int gen_posix_sem_unlock(
+ gen_sem_t * sem)
+{
+ return sem_post(sem);
+}
+
/*
* gen_mutex_init()
*
More information about the Pvfs2-cvs
mailing list