kernel - Make sure thread is released before migrating