Add some pthread error checks
Lock sc_logv and error output