> The wait_for method is why we have a condition variable at all. If it weren’t for that guy, we could have used std::atomic‘s wait and notify_all methods.
No, the std::mutex is the reason you have a condition variable. Never mix std::atomic with std::mutex-and-friends, you are very likely introducing race conditions that way.
I think you are misunderstanding what the article suggests. std::atomic::wait and std::atomic::notify_all are the C++ abstractions over futexes. The whole concept of the future can be expressed in terms of atomics and futexes. The only problem is that the C++ standard doesn't have std::atomic::wait_for.
You can indeed, but it would change the code from the article drastically: you have to get rid of the mutex, the discriminant becomes an atomic variable, and you need barriers between access to the discriminant and to the value the source is holding. Performance-wise I don't think it will show a drastic improvement, the main benefit would be the size of the source.