[C++] Using std::promise
C++\nclass Foo {\nprivate:\n  std::promise<void> p1;\n  std::promise<void> p2;\n\npublic:\n  void first(function<void()> printFirst) {\n    printFirst();\n    p
```C++\nclass Foo {\nprivate:\n  std::promise<void> p1;\n  std::promise<void> p2;\n\npublic:\n  void first(function<void()> printFirst) {\n    printFirst();\n    p1.set_value();\n  }\n\n  void second(function<void()> printSecond) {\n    p1.get_future().wait();\n    printSecond();\n    p2.set_value();\n  }\n\n  void third(function<void()> printThird) {\n    p2.get_future().wait();\n    printThird();\n  }\n};\n```
['C']