[dmd-concurrency] std.concurrency

Igor Lesik curoles at yahoo.com
Tue Mar 9 09:50:37 PST 2010


>By the way, I've been thinking about receive((int x) {}, (Variant x) {}) and I wonder if rather than testing the first element in the queue and having the Variant delegate getting the value if it's not an int, that the correct behavior should perhaps be to search the entire queue for an int and if there aren't any then take the first element and give it to the Variant.

Consider receive((int x){},(string s){}), first element in the queue is string, do you search for int in the whole queue in this case? No, you search for a handler for string. Case receive((int x) {}, (Variant x) {}) is not (and should not be) different. With what you propose user will experience very non deterministic behavior with messages processed completely out of order; consider long queue [var, string, ..., int] with int at end, why on earth user wants last element in the queue to be handled first?

Plus it will mess up msg priorities, in case we implement them one day.


      


More information about the dmd-concurrency mailing list