Adding extra exact-integer-sqrt tests.
Another thread patch from Lorenzo.  If we're reduced to scheduling
a single thread blocked on an fd and the poll fails, optimistically
unblock it (so it can block again naturally), instead of just running
it still in a wait status.