diff options
Diffstat (limited to 'Demo/threads/sync.py')
-rw-r--r-- | Demo/threads/sync.py | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Demo/threads/sync.py b/Demo/threads/sync.py index 3ad0fff..a8556c4 100644 --- a/Demo/threads/sync.py +++ b/Demo/threads/sync.py @@ -474,16 +474,16 @@ class mrsw: self.rwOK.release() def write_to_read(self): - self.rwOK.acquire() - if not self.writing: - raise ValueError, \ - '.write_to_read() invoked without an active writer' - self.writing = 0 - self.nw = self.nw - 1 - self.nr = self.nr + 1 - if not self.nw: - self.readOK.broadcast() - self.rwOK.release() + self.rwOK.acquire() + if not self.writing: + raise ValueError, \ + '.write_to_read() invoked without an active writer' + self.writing = 0 + self.nw = self.nw - 1 + self.nr = self.nr + 1 + if not self.nw: + self.readOK.broadcast() + self.rwOK.release() # The rest of the file is a test case, that runs a number of parallelized # quicksorts in parallel. If it works, you'll get about 600 lines of |