3 ms·
When I needed to use this function, it was because the Android API to run things asynchronously using Handler.post()/remove() seems to be incomplete. You want t
by empiricus 3y ago
When I needed to use this function, it was because the Android API to run things asynchronously using Handler.post()/remove() seems to be incomplete. You want to remove() a runnable, but maybe that runnable is executing in parallel exactly when you want to remove it. Depending on what you application does, this will cause various issues. The simplest way to fix issues in this case is to synchronize the threads using RunWithScissors. In short: the API is simple and easy to use, but it allows for strange cornercases, and you need a hack like RunWithScissors. That function is a hack because for various other reasons related to the rest of the API and the way it is implemented, it may block forever in some other cornercase. So maybe we can say this is broken behavior and an bad/incomplete API.
- klodolph 3y agoThat makes sense. Not making excuses for the API—but this does seem like a difficult design space to work in.