[YARP_OS] add convenience methods for locking port callbacks