Fixed thread interrupt handling.