From bff7f2b3b440c30d0d6eb692576af57ef42edd1b Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 8 Jul 2009 17:12:02 +0000 Subject: Comments and style adjustments, and a couple fixes. --- libdimension/progress.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libdimension/progress.c') diff --git a/libdimension/progress.c b/libdimension/progress.c index f366832..24f3a5e 100644 --- a/libdimension/progress.c +++ b/libdimension/progress.c @@ -63,6 +63,8 @@ dmnsn_new_progress() return NULL; } + /* Initialize the rwlock, condition variable, and mutex */ + if (pthread_rwlock_init(progress->rwlock, NULL) != 0) { free(progress->rwlock); free(progress->mutex); @@ -71,7 +73,6 @@ dmnsn_new_progress() free(progress); return NULL; } - if (pthread_cond_init(progress->cond, NULL) != 0) { if (pthread_rwlock_destroy(progress->rwlock) != 0) { dmnsn_error(DMNSN_SEVERITY_LOW, @@ -135,9 +136,8 @@ int dmnsn_finish_progress(dmnsn_progress *progress) int retval = 1; if (progress) { - if (pthread_cond_broadcast(progress->cond) != 0) { - dmnsn_error(DMNSN_SEVERITY_MEDIUM, "Couldn't signal condition variable."); - } + /* Wake up all waiters */ + dmnsn_done_progress(progress); if (pthread_join(progress->thread, &ptr) != 0) { /* Medium severity because an unjoined thread likely means that the thread -- cgit v1.2.3