pthread: track thread existence in a separate variable.