add primitives for socket / thread handling