From d2c8928d306861a39cc7c341e09f7e66b8f1c649 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 11 Feb 2013 23:11:32 +0000 Subject: Fix build against libpthread * configure.ac: Link against libpthread instead of libthreads. Explicitly link against libshouldbeinlibc. * cvs_tree.c: Include , use pthread functions instead of Mach cthreads functions. * cvsfs.h: Likewise. * netfs.c: Likewise. * node.c: Likewise. --- cvs_tree.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'cvs_tree.c') diff --git a/cvs_tree.c b/cvs_tree.c index 8f6403425..ee390c950 100644 --- a/cvs_tree.c +++ b/cvs_tree.c @@ -18,6 +18,7 @@ #include #include #include +#include #include "cvs_connect.h" #include "cvs_tree.h" @@ -270,7 +271,7 @@ cvs_tree_enqueue(struct netnode *dir, const char *path) new->fileno = next_fileno ++; new->node = NULL; - rwlock_init(&new->lock); + pthread_rwlock_init(&new->lock, NULL); if(parent) parent->child = new; @@ -297,12 +298,12 @@ cvs_tree_enqueue_file(struct netnode *cwd, { struct revision *cached_rev; - rwlock_writer_lock(&entry->lock); + pthread_rwlock_wrlock(&entry->lock); cached_rev = entry->revision; if(! (entry->revision = malloc(sizeof(*entry->revision)))) { - rwlock_writer_unlock(&entry->lock); + pthread_rwlock_unlock(&entry->lock); return ENOMEM; /* pray for cvsfs to survive! */ } @@ -310,8 +311,8 @@ cvs_tree_enqueue_file(struct netnode *cwd, entry->revision->contents = NULL; entry->revision->next = cached_rev; - rwlock_init(&entry->revision->lock); - rwlock_writer_unlock(&entry->lock); + pthread_rwlock_init(&entry->revision->lock, NULL); + pthread_rwlock_unlock(&entry->lock); return 0; } @@ -325,13 +326,13 @@ cvs_tree_enqueue_file(struct netnode *cwd, /* okay, we already got a netnode for file 'filename', check whether * revision information is up to date ... */ - rwlock_reader_lock(&entry->lock); + pthread_rwlock_rdlock(&entry->lock); if(! strcmp(revision, entry->revision->id)) { - rwlock_reader_unlock(&entry->lock); + pthread_rwlock_unlock(&entry->lock); return 0; /* head revision id hasn't changed ... */ } - rwlock_reader_unlock(&entry->lock); + pthread_rwlock_unlock(&entry->lock); /* okay, create new revision struct */ if(cvs_tree_add_rev_struct(entry, revision)) @@ -360,7 +361,7 @@ cvs_tree_enqueue_file(struct netnode *cwd, * to somewhere and this is the only thread to update tree info, * we don't have to write lock to access entry->revision! */ - rwlock_init(&entry->lock); + pthread_rwlock_init(&entry->lock, NULL); entry->revision = NULL; if(cvs_tree_add_rev_struct(entry, revision)) -- cgit v1.2.3