Make xseg_initialize/_join/_leave functions reentrant and thread-safe