File tree 2 files changed +19
-3
lines changed
2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,21 @@ def joiner(thread):
508
508
if errors :
509
509
raise errors [0 ]
510
510
511
+ def test_join_with_timeout (self ):
512
+ lock = _thread .allocate_lock ()
513
+ lock .acquire ()
514
+
515
+ def worker ():
516
+ lock .acquire ()
517
+
518
+ thread = threading .Thread (target = worker )
519
+ thread .start ()
520
+ thread .join (timeout = 0.01 )
521
+ assert thread .is_alive ()
522
+ lock .release ()
523
+ thread .join ()
524
+ assert not thread .is_alive ()
525
+
511
526
def test_no_refcycle_through_target (self ):
512
527
class RunSelfFunction (object ):
513
528
def __init__ (self , should_raise ):
Original file line number Diff line number Diff line change @@ -1254,9 +1254,10 @@ def is_alive(self):
1254
1254
if self ._is_stopped or not self ._started .is_set ():
1255
1255
return False
1256
1256
self ._wait_for_tstate_lock (False )
1257
- if self ._is_stopped :
1258
- self ._join_os_thread ()
1259
- return not self ._is_stopped
1257
+ if not self ._is_stopped :
1258
+ return True
1259
+ self ._join_os_thread ()
1260
+ return False
1260
1261
1261
1262
@property
1262
1263
def daemon (self ):
You can’t perform that action at this time.
0 commit comments