File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -743,19 +743,21 @@ def test_racing_getbuf_and_releasebuf(self):
743743 from multiprocessing .managers import SharedMemoryManager
744744 except ImportError :
745745 self .skipTest ("Test requires multiprocessing" )
746- from threading import Thread
746+ from threading import Thread , Event
747747
748- n = 100
748+ start = Event ()
749749 with SharedMemoryManager () as smm :
750750 obj = smm .ShareableList (range (100 ))
751- threads = []
752- for _ in range (n ):
753- # Issue gh-127085, the `ShareableList.count` is just a convenient way to mess the `exports`
754- # counter of `memoryview`, this issue has no direct relation with `ShareableList`.
755- threads .append (Thread (target = obj .count , args = (1 ,)))
756-
751+ def test ():
752+ # Issue gh-127085, the `ShareableList.count` is just a
753+ # convenient way to mess the `exports` counter of `memoryview`,
754+ # this issue has no direct relation with `ShareableList`.
755+ start .wait (support .SHORT_TIMEOUT )
756+ for i in range (10 ):
757+ obj .count (1 )
758+ threads = [Thread (target = test ) for _ in range (10 )]
757759 with threading_helper .start_threads (threads ):
758- pass
760+ start . set ()
759761
760762 del obj
761763
You can’t perform that action at this time.
0 commit comments