def METHOD_NAME(self, new_value):
    if new_value > super().maximum():
        new_value = super().maximum()
    elif new_value < super().minimum():
        new_value = super().minimum()
    self.lock.acquire()
    super().setValue(new_value)
    self.lock.release()