'Adds a listener for scheduler events. When a matching event occurs,
``callback`` is executed with the event object as its sole argument.
If the ``mask`` parameter is not provided, the callback will receive
events of all types.
:param callback: any callable that takes one argument
:param mask: bitmask that indicates which events should be listened to'

def add_listener(self, callback, mask=EVENT_ALL):

    self._listeners_lock.acquire()
    try:
        self._listeners.append((callback, mask))
    finally:
        self._listeners_lock.release()
