29 virtual void orphan() = 0;
34 template<
typename t_receiver>
38 if (m_receiver != NULL) {
39 m_receiver->on_task_completion(m_taskid,p_code);
42 void setup(t_receiver * p_receiver,
unsigned p_task_id) {m_receiver = p_receiver; m_taskid = p_task_id;}
43 void orphan() {m_receiver = NULL; m_taskid = 0;}
49 template<
typename t_receiver>
52 instance->setup(p_receiver,p_taskid);
64 completion_notify::ptr create_or_get_task(
unsigned p_id);
66 bool have_task(
unsigned p_id)
const;
67 void orphan_task(
unsigned p_id);
69 void orphan_all_tasks();
void on_completion(unsigned p_code)
Called when an async operation has been completed. Note that on_completion is always called from main...
Generic service for receiving notifications about async operation completion. Used by various other s...
Template implementing reference-counting features of service_base. Intended for dynamic instantiation...
service_ptr_t< completion_notify > completion_notify_ptr
static void g_signal_completion_async(service_ptr_t< completion_notify > p_notify, unsigned p_code)
Helper. Checks for null ptr and calls on_completion_async when the ptr is not null.
virtual void on_task_completion(unsigned p_id, unsigned p_status)
FB2K_MAKE_SERVICE_INTERFACE(completion_notify, service_base)
service_nnptr_t< completion_notify_orphanable > completion_notify_orphanable_nnptr
void on_completion(unsigned p_code)
Called when an async operation has been completed. Note that on_completion is always called from main...
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes. This assumes that the pointers are valid all the time (can't point to null). Mainly intended to be used for scenarios where null pointers are not valid and relevant code should crash ASAP if somebody passes invalid pointers around. You want to use service_ptr_t<> rather than service_nnptr_t<> most of the time.
void on_completion_async(unsigned p_code)
Helper. Queues a notification, using main_thread_callback.
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
service_ptr_t< completion_notify_orphanable > completion_notify_orphanable_ptr
completion_notify::ptr makeCompletionNotify(completionNotifyFunc_t func)
Modern completion_notify helper.
service_nnptr_t< completion_notify > completion_notify_nnptr
Helper implementation. IMPLEMENTATION WARNING: If process being completed creates a window taking cal...
std::function< void(unsigned)> completionNotifyFunc_t
void setup(t_receiver *p_receiver, unsigned p_task_id)
Helper base class for classes that manage nonblocking tasks and get notified back thru completion_not...
service_nnptr_t< completion_notify_orphanable > completion_notify_create(t_receiver *p_receiver, unsigned p_taskid)
static void orphanfunc(unsigned, completion_notify_orphanable_nnptr p_item)
pfc::map_t< unsigned, completion_notify_orphanable_nnptr > m_tasks
virtual void on_completion(unsigned p_code)=0
Called when an async operation has been completed. Note that on_completion is always called from main...