On Friday, 29 August 2014 at 17:29:34 UTC, H. S. Teoh via Digitalmars-d wrote:
The code figures out which signals to send to which delegates
*at runtime*. The way this is done is to use the .mangleof of
the struct's type as key to an AA

I think there might be an easier way to do this too: cast(size_t) typeid(T). That'd be a unique integer for each type too that could be passed through the pipe... IIRC the reason I went with the mangle hash though was to work across processes, where the TypeInfo pointer might not as reliable (my rpc.d file works more in that direction but I can't recall if I actually finished it or not).

BTW that eventloop thing uses malloc/free now whereas in the first draft it used the GC. Why? While the pointer was sitting in the kernel pipe buffer, the GC would sometimes collect it, causing random crashes. Just because the pointer hasn't left the program entirely doesn't mean the GC can still see it! I think I wrote this story in my book too in one of those little info boxes.

Reply via email to