From 1e86d1f3cc8166b8303e208e3a12922d44061317 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 12 Jul 2007 09:28:26 +0000 Subject: [PATCH] demand-attach-init-fsstate-rwlock-20070712 the rwlock needs to be initd before use --- src/viced/viced.c | 1 + src/viced/viced.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/viced/viced.c b/src/viced/viced.c index 45a7c9c51..c4996f56b 100644 --- a/src/viced/viced.c +++ b/src/viced/viced.c @@ -2185,6 +2185,7 @@ main(int argc, char *argv[]) #ifdef AFS_PTHREAD_ENV ViceLog(5, ("Starting pthreads\n")); + FS_STATE_INIT; assert(pthread_attr_init(&tattr) == 0); assert(pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED) == 0); diff --git a/src/viced/viced.h b/src/viced/viced.h index e6e08a107..e632bc87a 100644 --- a/src/viced/viced.h +++ b/src/viced/viced.h @@ -246,6 +246,7 @@ struct fs_state { extern struct fs_state fs_state; /* this lock is defined to be directly above FS_LOCK in the locking hierarchy */ +#define FS_STATE_INIT assert(pthread_rwlock_init(&fs_state.state_lock, NULL) == 0) #define FS_STATE_RDLOCK assert(pthread_rwlock_rdlock(&fs_state.state_lock) == 0) #define FS_STATE_WRLOCK assert(pthread_rwlock_wrlock(&fs_state.state_lock) == 0) #define FS_STATE_UNLOCK assert(pthread_rwlock_unlock(&fs_state.state_lock) == 0) -- 2.39.5