Implement mainloop_running(), QueuedFunc::queued() and TimedFunc::running() and make use of them