2 #include "oxygine-include.h" 3 #include "core/ThreadDispatcher.h" 4 #include "EventDispatcher.h" 6 #include "core/oxygine.h" 13 DECLARE_SMART(AsyncTask, spAsyncTask);
28 ERROR = sysEventID(
'A',
'T',
'E'),
29 PROGRESS = sysEventID(
'A',
'T',
'P'),
30 COMPLETE = Event::COMPLETE,
45 status getStatus()
const {
return _status; }
46 void setStatus(status s) { _status = s; }
55 friend class AsyncTaskManager;
59 virtual bool _prerun() {
return true; }
60 virtual void _run() = 0;
61 virtual void _onError() {}
62 virtual void _onComplete() {}
63 virtual void _onFinal(
bool error) {}
64 virtual void _finalize(
bool error) {}
65 virtual void _dispatchComplete();
66 virtual std::string _getRunInfo()
const {
return ""; }
70 void sync(
const F& f,
bool addref =
true)
77 if (!core::isMainThread())
81 core::getMainThreadDispatcher().postCallback([ = ]()
89 core::getMainThreadDispatcher().postCallback(f);
–oxgl-end–!
Definition: Actor.h:14
Definition: AsyncTask.h:15
Definition: EventDispatcher.h:27
Definition: AsyncTask.h:23