1
0
mirror of https://github.com/janet-lang/janet synced 2025-07-03 10:32:53 +00:00

Don't call pthread cancel on normal exits.

Calling pthread_cancel on threads that can exit normally is not needed.
Instead, we immediately call pthread_join if a thread can exit normally.
This commit is contained in:
Calvin Rose 2025-05-18 09:50:27 -05:00
parent e355cb07e0
commit 92e91259c3
2 changed files with 2635 additions and 2631 deletions

File diff suppressed because it is too large Load Diff

View File

@ -564,15 +564,17 @@
(,ev/deadline ,sec nil ,f true) (,ev/deadline ,sec nil ,f true)
(,resume ,f)))) (,resume ,f))))
(repeat 10 (for i 0 10
(assert (= :done (with-deadline2 10 # (print "iteration " i)
(ev/sleep 0.01) (assert (= :done (with-deadline2 10
:done)) "deadline with interrupt exits normally")) (ev/sleep 0.01)
:done)) "deadline with interrupt exits normally"))
(repeat 10 (for i 0 10
(let [f (coro (forever :foo))] # (print "iteration " i)
(ev/deadline 0.01 nil f true) (let [f (coro (forever :foo))]
(assert-error "deadline expired" (resume f)))) (ev/deadline 0.01 nil f true)
(assert-error "deadline expired" (resume f))))
# Use :err :stdout # Use :err :stdout
(def- subproc-code '(do (eprint "hi") (eflush) (print "there") (flush))) (def- subproc-code '(do (eprint "hi") (eflush) (print "there") (flush)))