Minor edit to get the errno right in resumeThread if the user-level
scheduler associated with the thread blocked on the foreign call had
already been resumed.
Fixes for safe-foreign calls. tso->release_ULS added to indicate that
the thread resuming after a safe-foreign function all that its
user-level scheduler has been already resumed. Hence, the next time this
thread enters the scheduler loop, it gives up its scheduler.
Extending the safe-foreign call fix (previous commit) to ThreadSwitch.
During a thread switch, if the source thread had been marked to release
the scheduler, this flag is inherited by the target thread (thread being
switched to). scheduleHandleThreadSwitch takes care of releasing the
scheduler.