Process pending thread events when unblocking them.
Partly fixes bug where profiler never got a chance to run when the
program was doing most of its work in short routines that block and
unblock thread events, like opening and closing files.
Only partly, because it seems something else unblocks thread events
without processing them -- until we do another block/unblock cycle as
in channel-close. Verified that very little time is actually spent
in channel-close; haven't yet tracked down who the culprit is.