File tree 1 file changed +11
-9
lines changed
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):
743
743
from multiprocessing .managers import SharedMemoryManager
744
744
except ImportError :
745
745
self .skipTest ("Test requires multiprocessing" )
746
- from threading import Thread
746
+ from threading import Thread , Event
747
747
748
- n = 100
748
+ start = Event ()
749
749
with SharedMemoryManager () as smm :
750
750
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 )]
757
759
with threading_helper .start_threads (threads ):
758
- pass
760
+ start . set ()
759
761
760
762
del obj
761
763
You can’t perform that action at this time.
0 commit comments