threadsafe peer functions