concurrency

Christopher Wright dhasenan at gmail.com
Mon Feb 4 20:20:18 PST 2008


Craig Black wrote:
> In that case, it may be beneficial to somehow separate parallel and 
> sequential events, perhaps with separate event queues.  However, it would 
> require that each event knows whether it is "pure" or not, so that it is 
> placed on the appropriate queue.

A static if or two in the event broker would solve it. There would be a 
method:
void subscribe (T)(EventTopic topic, T delegate) {
    static assert (is (T == delegate));
    static if (is (T == pure)) {
       // add to the pure event subscribers for auto parallelization
    } else {
       // add to the impure ones
    }
}

> -Craig 



More information about the Digitalmars-d mailing list