]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Renamed a variable and removed two statements that were commented out.
authorBart Van Assche <bvanassche@acm.org>
Wed, 24 Dec 2008 09:45:41 +0000 (09:45 +0000)
committerBart Van Assche <bvanassche@acm.org>
Wed, 24 Dec 2008 09:45:41 +0000 (09:45 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8880

drd/drd_clientobj.h
drd/drd_semaphore.c

index f9c94469a3f9e268be18fb761c2a09c6e0da03c7..1bfdd9337f70397d8c07888ea7057cb664578cfa 100644 (file)
@@ -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().
index 6dd600858447a425d8d2073191fd4bd3d124c378..1637cfe47f33ac02a43161175aab0f8880577ef9 100644 (file)
@@ -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);