Allows for running the event loop in 3 modes: * default: loop runs until the refcount drops to zero * once: poll for events only once and block until one is handled * nowait: poll for events only once but don't block if there are no pending events