QuantumLeaps/Super-Simple-Tasker

Signal implementation

Xeenych opened this issue · 2 comments

Signal is implemented now as uint16_t.

So you need a big switch in dispatch() function to handle each signal and downcast<> template.

Signal could be implemented as function pointer void(*)() or even as a struct

struct {
void (*)(void*) func;
void* arg;
}

thus dispatch function will need to just call func(arg) without need to handle big switch operator

I presume that the proposed function pointers would point to the "event-handler" functions. This is problematic for several reasons.

First, the handling of an event depends on both the signal and the state of the receiving active object, so only one "event handler" won't do.

Second, the same event can be handled differently by different active objects, so again, one "event handler" won't do.

Third, the "event handler" function in general needs to access some additional data. This data is typically encapsulated inside the receiving active object. So, such a function would need to have access to such data.

This issue is closed as not viable to implement.
--MMS