Re:Why Ruby's Timeout is dangerous (and Thread.raise is terr...
by WJW on Monday June 03, 2024 @07:37AM
(#40561664)
I don't know why you think that it isn't. You can do so, but AFAIK almost no libraries are written with the expectation that their computations might be interrupted at any time by another thread. The best you can hope for is that you "only" interrupt some pure computation and not throw your exception into the middle of some delicately sequenced IO side effects.
[ Parent
| on HN ]
Re:Why Ruby's Timeout is dangerous (and Thread.raise is terr...
by whateveracct on Monday June 03, 2024 @11:14AM
(#40563468)
> AFAIK almost no libraries are written with the expectation that their computations might be interrupted at any time by another thread.
Haskell libraries are written this way all the time. Exception-safe libraries with async-aware handling are pretty commonplace nowadays (partially thanks to safe-exceptions and unsafeio providing a nice API to deal with them.)
Re:Why Ruby's Timeout is dangerous (and Thread.raise is terr...
by kccqzy on Monday June 03, 2024 @04:00PM
(#40566877)
Absolutely false. At least not in my experience. Only novice Haskell programmers write code that can't handle computations being interrupted by another thread. A published and maintained Haskell library is unlikely to have these issues.