volser transaction object race conditions
[openafs.git] / src / volser / volser.p.h
index 19121e6..7fe5995 100644 (file)
@@ -58,6 +58,9 @@ struct volser_trans {
     /* the fields below are useful for debugging */
     char lastProcName[30];     /* name of the last procedure which used transaction */
     struct rx_call *rxCallPtr; /* pointer to latest associated rx_call */
+#ifdef AFS_PHTREAD_ENV
+    pthread_mutex_t lock;       /* per transaction lock */
+#endif
 
 };
 
@@ -72,6 +75,22 @@ struct volser_dest {
     afs_int32 destSSID;
 };
 
+#ifdef AFS_PHTREAD_ENV
+#define VTRANS_OBJ_LOCK_INIT(tt) \
+  assert(pthread_mutex_init(&((tt)->lock)) == 0)
+#define VTRANS_OBJ_LOCK_DESTROY(tt) \
+  assert(pthread_mutex_destroy(&((tt)->lock)) == 0)
+#define VTRANS_OBJ_LOCK(tt) \
+  assert(pthread_mutex_lock(&((tt)->lock)) == 0)
+#define VTRANS_OBJ_UNLOCK(tt) \
+  assert(pthread_mutex_unlock(&((tt)->lock)) == 0)
+#else
+#define VTRANS_OBJ_LOCK_INIT(tt)
+#define VTRANS_OBJ_LOCK_DESTROY(tt)
+#define VTRANS_OBJ_LOCK(tt)
+#define VTRANS_OBJ_UNLOCK(tt)
+#endif /* AFS_PTHREAD_ENV */
+
 #define        MAXHELPERS          10
 /* flags for vol helper busyFlags array.  First, VHIdle goes on when a server
  * becomes idle.  Next, idle flag is cleared and VHRequest goes on when