14 #ifndef ZYPP_BASE_EVENTDISPATCHER_DEFINED 15 #define ZYPP_BASE_EVENTDISPATCHER_DEFINED 18 #include <zypp-core/ng/base/Signals> 19 #include <zypp-core/ng/base/Base> 20 #include <zypp-core/ng/base/AbstractEventSource> 32 class EventDispatcherPrivate;
50 using
Ptr = EventDispatcherRef;
75 ev->invokeOnIdleImpl( std::move(callback) );
82 template<
typename T = TimeoutFunction >
87 ev->invokeAfterImpl( std::forward<T>(callback), timeout );
101 template<
typename T >
105 ev->unrefLaterImpl( std::static_pointer_cast<void>( std::forward<T>(ptr) ) );
125 static std::shared_ptr<EventDispatcher>
instance();
146 static bool waitForFdEvent (
const int fd,
int events,
int &revents,
int &timeout );
virtual void removeTimer(Timer &timer)
static void unrefLater(T &&ptr)
static void invokeAfter(T &&callback, uint32_t timeout)
Convenience function to schedule a callback to be called later.
std::weak_ptr< Base > WeakPtr
GMainContext * glibContext()
std::function< bool()> IdleFunction
static void setThreadDispatcher(const std::shared_ptr< EventDispatcher > &disp)
std::function< bool()> TimeoutFunction
std::function< void(int, int)> WaitPidCallback
void * nativeDispatcherHandle() const
Returns the native dispatcher handle if the used implementation supports it.
static bool waitForFdEvent(const int fd, int events, int &revents, int &timeout)
void unrefLaterImpl(std::shared_ptr< void > &&ptr)
The Timer class provides repetitive and single-shot timers.
void trackChildProcess(int pid, std::function< void(int, int)> callback)
static void invokeOnIdle(IdleFunction &&callback)
Convenience function to schedule a callback to be called later.
EventDispatcher(void *ctx=nullptr)
virtual void updateEventSource(AbstractEventSource ¬ifier, int fd, int mode)
static std::shared_ptr< EventDispatcher > instance()
void clearUnrefLaterList()
ulong runningTimers() const
virtual void registerTimer(Timer &timer)
virtual void removeEventSource(AbstractEventSource ¬ifier, int fd=-1)
#define ZYPP_DECLARE_PRIVATE(Class)
ZYPP_FWD_DECL_TYPE_WITH_REFS(EventDispatcher)
void invokeAfterImpl(TimeoutFunction &&callback, uint32_t timeout)
bool untrackChildProcess(int pid)
void invokeOnIdleImpl(IdleFunction &&callback)
UnixSignalSourceRef unixSignalSource()
struct _GMainContext GMainContext
std::shared_ptr< Base > Ptr