diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-02-11 23:11:32 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2013-02-11 23:11:32 +0000 |
commit | d2c8928d306861a39cc7c341e09f7e66b8f1c649 (patch) | |
tree | 4c11599bf8b3287a2c57ea361b3d9e47a09b58c4 /cvs_tree.c | |
parent | 43df67ad041fda13c795b8b91fc45e8b71c047cf (diff) |
Fix build against libpthread
* configure.ac: Link against libpthread instead of libthreads.
Explicitly link against libshouldbeinlibc.
* cvs_tree.c: Include <pthread.h>, use pthread functions instead of Mach
cthreads functions.
* cvsfs.h: Likewise.
* netfs.c: Likewise.
* node.c: Likewise.
Diffstat (limited to 'cvs_tree.c')
-rw-r--r-- | cvs_tree.c | 19 |
1 files changed, 10 insertions, 9 deletions
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 <stdio.h> #include <string.h> #include <stdlib.h> +#include <pthread.h> #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)) |