Hi, While digging a bug reported in, I realized an assumption we shouldn't make in our code. https://issues.apache.org/jira/browse/MESOS-5023
Say you have the following code: void some_func() { future .onAny(callback_A) .onAny(callback_B); } Question: will callback_A already be executed before callback_B? The answer is NO. We should never assume that. Under the following interleaving, callback_B can be invoked first: Thread-1 Thread-2 onAny(callback_A) { onAnyCallbacks.push_back(callback_A); } set() { lock() if (state == PENDING) { state = READY; result = true; } unlock(); onAny(callback_B) { lock() if (state != PENDING) { run = true } unlock() if (run) { callback_B() } if (result) { internal::run(data->onAnyCallbacks, *this); } - Jie