Skip to content

Commit

Permalink
deque: make most functions thread-safe
Browse files Browse the repository at this point in the history
This adds a mutex to every deque object. It's acquired around
most operations. Some remaining functions, which are not yet
thread-safe are:

 - deque.copy
 - deque.__init__
  • Loading branch information
colesbury committed Apr 23, 2023
1 parent 6323ca6 commit f1e4742
Show file tree
Hide file tree
Showing 2 changed files with 199 additions and 89 deletions.
2 changes: 1 addition & 1 deletion Lib/test/test_deque.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ class C(object):
def test_sizeof(self):
MAXFREEBLOCKS = 16
BLOCKLEN = 64
basesize = support.calcvobjsize('2P5n%dPP' % MAXFREEBLOCKS)
basesize = support.calcvobjsize('3P5n%dPP' % MAXFREEBLOCKS)
blocksize = struct.calcsize('P%dPP' % BLOCKLEN)
self.assertEqual(object.__sizeof__(deque()), basesize)
check = self.check_sizeof
Expand Down
Loading

0 comments on commit f1e4742

Please sign in to comment.