moved the operation for the exit to one function.

The operation to up the semaphore is one of the part of
requestExit().