The SUSv4tc1 requires that pthread_setcancelstate() shall be not a
cancellation point.  When enabling the cancellation, only process the
pending cancellation for asynchronous mode.

Reported and reviewed by:	Kohji Okuno <okuno.kohji@jp.panasonic.com>
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Some clarifications and updates for the comments, mostly retrieved
from Bruce Evans.  Trim the trailing spaces.

MFC after:	1 week
Fix an unfortunate typo with the compat shims

Obtained from:	Netflix
MFC after:	now