
weston
2017-7-17 23:16:54
@weston has joined the channel

notjack
2017-7-18 00:50:37
What’s the best way to take a thunk and make it run after the current thread dies?

lexi.lambda
2017-7-18 00:51:51
@notjack I have no idea if this would work, but would (let ([t (current-thread)]) (thread (lambda () (sync t) (thunk))))
do something useful?

lexi.lambda
2017-7-18 00:52:15
I realize I don’t actually know what happens if a thread waits on the thread that spawned it

samth
2017-7-18 00:53:40
that should work

notjack
2017-7-18 00:54:26
hmms. what about if the thread exits abnormally? e.g. an exception or escape continuation jump?

notjack
2017-7-18 00:55:13
I’ve seen thread-dead-evt
in the docs which might help

lexi.lambda
2017-7-18 01:02:34
I think a continuation jump couldn’t change a thread’s liveness, since that would just change the continuation of the current thread

lexi.lambda
2017-7-18 01:03:08
and an unhandled exception would still just kill the thread