From fec153f2f1e93feff7c01ac57be1125888a7b7e0 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 24 Dec 2008 09:45:41 +0000 Subject: [PATCH] Renamed a variable and removed two statements that were commented out. git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8880 --- drd/drd_clientobj.h | 3 ++- drd/drd_semaphore.c | 10 ++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/drd/drd_clientobj.h b/drd/drd_clientobj.h index f9c94469a3..1bfdd9337f 100644 --- a/drd/drd_clientobj.h +++ b/drd/drd_clientobj.h @@ -89,7 +89,8 @@ struct semaphore_info ObjType type; void (*cleanup)(union drd_clientobj*); ExeContext* first_observed_at; - UInt initial_value; // Value assigned through sem_init(). + UInt waits_to_skip; // Number of sem_wait() calls to skip + // (due to the value assigned by sem_init()). UInt value; // Semaphore value. UWord waiters; // Number of threads inside sem_wait(). DrdThreadId last_sem_post_tid; // Thread ID associated with last sem_post(). diff --git a/drd/drd_semaphore.c b/drd/drd_semaphore.c index 6dd6008584..1637cfe47f 100644 --- a/drd/drd_semaphore.c +++ b/drd/drd_semaphore.c @@ -94,7 +94,7 @@ void semaphore_initialize(struct semaphore_info* const p, const Addr semaphore) tl_assert(p->type == ClientSemaphore); p->cleanup = (void(*)(DrdClientobj*))semaphore_cleanup; - p->initial_value = 0; + p->waits_to_skip = 0; p->value = 0; p->waiters = 0; p->last_sem_post_tid = DRD_INVALID_THREADID; @@ -151,10 +151,8 @@ static struct semaphore_info* semaphore_get(const Addr semaphore) struct semaphore_info* semaphore_init(const Addr semaphore, const Word pshared, const UInt value) { - /* unsigned n; */ struct semaphore_info* p; Segment* sg; - /* const DrdThreadId drd_tid = thread_get_running_tid(); */ if (s_trace_semaphore) { @@ -186,7 +184,7 @@ struct semaphore_info* semaphore_init(const Addr semaphore, p = semaphore_get_or_allocate(semaphore); } tl_assert(p); - p->initial_value = value; + p->waits_to_skip = value; p->value = value; return p; } @@ -272,8 +270,8 @@ void semaphore_post_wait(const DrdThreadId tid, const Addr semaphore, } p->value--; tl_assert((int)p->value >= 0); - if (p->initial_value > 0) - p->initial_value--; + if (p->waits_to_skip > 0) + p->waits_to_skip--; else { sg = segment_pop(p); -- 2.47.2