]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
scheduler, ticket lock: Add memory barriers necessary to avoid a deadlock on PowerPC...
authorBart Van Assche <bvanassche@acm.org>
Thu, 19 Apr 2012 11:00:32 +0000 (11:00 +0000)
committerBart Van Assche <bvanassche@acm.org>
Thu, 19 Apr 2012 11:00:32 +0000 (11:00 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@12509

coregrind/m_scheduler/ticket-lock-linux.c

index 865c79ec3e27c09449a8b00737c4c343620c56b5..e28841cc882c44e5383b4212ca1eb987004fd565 100644 (file)
@@ -127,6 +127,7 @@ static void acquire_sched_lock(struct sched_lock *p)
                   VG_(gettid)(), ticket);
    for (;;) {
       futex_value = *futex;
+      __sync_synchronize();
       if (ticket == p->head)
          break;
       if (s_debug)
@@ -142,6 +143,7 @@ static void acquire_sched_lock(struct sched_lock *p)
          vg_assert(False);
       }
    }
+   __sync_synchronize();
    INNER_REQUEST(ANNOTATE_RWLOCK_ACQUIRED(p, /*is_w*/1));
    vg_assert(p->owner == 0);
    p->owner = VG_(gettid)();