Henrik Grubbstr?m (Lysator) @ Pike (-) developers forum wrote:
I propose ripping out the call_out() method, so that callouts are ran directly in all cases except for the timeout-case.
Not a good idea:
- Unlimited stack use.
I realised that too. That is a definite downside.
- Potential deadlocks/data inconsistency.
This could be considered a plus. Properly written thread-safe code, should not be vulnerable to this. So turning off the call_out() intermediary could be considered a relatively robust way to check if your regular code is actually deadlock-free and thread-safe.
I'm not so sure; eg the following will hang:
Thread.Mutex mux = Thread.Mutex();
void producer() { Thread.MutexKey key = mux->lock();
...
promise->success(x);
...
key = 0; }
void got_sucess(mixed x) { Thread.Mutex key = mux->lock();
... }
- No serialization of calls.
Same thing here. It could reorder the calls; then again, if your code is resistant against this, then it has been written in a robust manner.
Reordering is fine; concurreny is not.
/grubba