29#ifndef PT_SELECTABLE_H
30#define PT_SELECTABLE_H
32#include <Pt/System/Api.h>
33#include <Pt/NonCopyable.h>
61 friend class SelectableList;
NonCopyable()
Default constructor.
Definition NonCopyable.h:63
Event loop of a thread or process.
Definition EventLoop.h:83
Operation that runs through an event loop.
Definition Selectable.h:60
void cancel()
Cancels all operations.
bool run()
Run operation if it is ready.
virtual bool onRun()=0
Check if ready and run.
virtual void onCancel()=0
Blocks until operation has cancelled.
Selectable()
Default Constructor.
virtual ~Selectable()
Destructor.
void setActive(EventLoop &parent)
Sets the parent loop, so that operations can be run.
virtual void onDetach(EventLoop &)
Detached from loop.
Definition Selectable.h:100
void post()
Posts this selectable to its event loop from any thread.
void detach()
Remove from event loop and cancels outstanding operations.
virtual void onAttach(EventLoop &)
Attached to loop.
Definition Selectable.h:96
EventLoop * parent() const
Returns the used event loop.
Definition Selectable.h:80
System programming
Definition Connection.h:26
Core module.
Definition Allocator.h:33