Patchwork [trans-mem] missing case in rwlock::write_upgrade

login
register
mail settings
Submitter Patrick Marlier
Date March 2, 2011, 2:04 p.m.
Message ID <4D6E4E62.7030008@unine.ch>
Download mbox | patch
Permalink /patch/85085/
State New
Headers show

Comments

Patrick Marlier - March 2, 2011, 2:04 p.m.
In libitm, a specific case is missing in rwlock::write_upgrade. Indeed, 
if there is no concurrent active reader while upgrading the lock, we 
have to unset the a_reader bit (we were the only reader).

Patrick Marlier.

libitm/
	* config/posix/rwlock.cc (write_upgrade): Add missing case.
Richard Henderson - March 2, 2011, 10:28 p.m.
On 03/03/2011 12:04 AM, Patrick Marlier wrote:
>     * config/posix/rwlock.cc (write_upgrade): Add missing case.

Applied.


r~

Patch

Index: libitm/config/posix/rwlock.cc
===================================================================
--- libitm/config/posix/rwlock.cc	(revision 170587)
+++ libitm/config/posix/rwlock.cc	(working copy)
@@ -130,6 +130,11 @@ 
       // We only return from upgrade when we've got it; don't loop.
       assert ((sum & (a_reader | a_writer)) == 0);
     }
+  else
+    {
+      // We were the only reader.
+      sum &= ~a_reader;
+    }
 
   // Otherwise we can upgrade to writer.
   this->summary = sum | a_writer;