On successful completion, this routine returns the calling
thread's previous cancelability state in the location specified
by the oldstate argument.
If an error condition occurs, this routine returns an integer
value indicating the type of error. Possible return values are as
follows:
Return Description
0 Successful completion.
[EINVAL] The specified state is not PTHREAD_CANCEL_ENABLE or
PTHREAD_CANCEL_DISABLE.