fix bugs of pthreads junk not being async safe.
we were calling fprintf from a signal handler
(interrupt) while fprintf was currently in progress
and the pthread junk did not like that.