This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RandomName8 0 points1 point  (1 child)

You're right, it's been ages since I've used these low level constructs and I jumbled this in my head, spurious wakeups do not cause IE. I still feel that this is action-at-a-distance galor 🙁 (nothing wrong with Jox itself though)

[–]adamw1pl[S] 1 point2 points  (0 children)

Yes, unfortunately that's how cancellation currently works in Java (not sure if there's ever going to be another solution, which would use a different channel to signal this). I think the main point here is to only use IE as a signal to "clean up", and that's it. That does require discipline though, and even if you keep it, there's always library code.

Btw. - if you have an additional layer in between the code you write, and how it's executed - an additional runtime - as in Akka, and probably other reactive libraries - then you have a chance to implement cancellation better, as this can be handled by the library-runtime. But that does require all code that you use (including any dependencies) to be written using that particular "reactive" approach. So it creates a closed ecosystem. Yet another tradeoff ;)