Force throwTo to block until the exception handler exits

I would like to be able to handle the async exception in the thread A, so if another thread Bcalls throwTo, this call is blocked until my handler in Acan finish. As far as I understand, it is throwToblocked only until the exception is "received".

I thought maybe some clever use uninterruptibleMaskmight help me, but I'm at a dead end.

EDIT : I noticed this :

The difference between using try and catch for recovery is that the catch handler is inside the implicit block (see "Asynchronous Exceptions"), which is important when catching asynchronous exceptions, ...

I thought this could mean that catchit would really do what I was looking for (I used onException), but that doesn't seem to be the case. So, as an additional question: what does “handler inside implicit blockmean here?

+4
source share

Source: https://habr.com/ru/post/1537437/


All Articles