Skip to content

Commit

Permalink
switch to snakecase for threading related functions (bbangert#213)
Browse files Browse the repository at this point in the history
  • Loading branch information
Narendra-Neerukonda authored Dec 7, 2021
1 parent c8e1162 commit d4ab7d3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions beaker/synchronization.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,10 +328,10 @@ def do_release_read_lock(self):
# check if we are the last asynchronous reader thread
# out the door.
if self.asynch == 0:
# yes. so if a sync operation is waiting, notifyAll to wake
# yes. so if a sync operation is waiting, notify_all to wake
# it up
if self.current_sync_operation is not None:
self.condition.notifyAll()
self.condition.notify_all()
elif self.asynch < 0:
raise LockError("Synchronizer error - too many "
"release_read_locks called")
Expand All @@ -357,7 +357,7 @@ def do_acquire_write_lock(self, wait=True):
# establish ourselves as the current sync
# this indicates to other read/write operations
# that they should wait until this is None again
self.current_sync_operation = _threading.currentThread()
self.current_sync_operation = _threading.current_thread()

# now wait again for asyncs to finish
if self.asynch > 0:
Expand All @@ -377,7 +377,7 @@ def do_acquire_write_lock(self, wait=True):
def do_release_write_lock(self):
self.condition.acquire()
try:
if self.current_sync_operation is not _threading.currentThread():
if self.current_sync_operation is not _threading.current_thread():
raise LockError("Synchronizer error - current thread doesnt "
"have the write lock")

Expand All @@ -386,7 +386,7 @@ def do_release_write_lock(self):
self.current_sync_operation = None

# tell everyone to get ready
self.condition.notifyAll()
self.condition.notify_all()
finally:
# everyone go !!
self.condition.release()

0 comments on commit d4ab7d3

Please sign in to comment.