heim_base_atomic_inc
type->tid = heim_base_atomic_inc(&tidglobal);
if ((heim_base_atomic_inc(&p->ref_cnt) - 1) == 0)