MFC r325771, r325777, r325778 (all by jhb):
Only clear a pending thread event if one is pending.
This fixes a panic when attaching to an already-stopped process.
Also do some other clean ups for control flow of sendsig section.
Reviewed by: jhb
Sponsored by: The FreeBSD Foundation