tree: 3b613e5ff4c2ff1c41d101b37b73d5cbbd94fcb6 [path history] [tgz]
  1. include/
  2. tests/
  3. barrier.cc
  4. BUILD.gn
  5. fit-promise.api
  6. METADATA.textproto
  7. OWNERS
  8. promise.cc
  9. README.md
  10. scheduler.cc
  11. scope.cc
  12. sequencer.cc
  13. single_threaded_executor.cc
sdk/lib/fit-promise/README.md

fit-promise library

This was formerly part of the lib/fit library. Further migrations and renamings are expected.

fpromise::promise, fpromise::future, fpromise::executor, etc.

  • When writing asynchronous event-driven programs, it's convenient to be able to stage a sequence of asynchronous tasks. This tends to be challenging to implement in a callback-driven manner due to object lifetime issues, so we would like an alternative pattern that is easier to apply correctly, such as by expressing asynchronous logic as a compositions of futures.
  • The C++ 14 standard library offers std::future but it is tied to a thread-based execution model. Awaiting a future requires blocking, which is bad for event loops.
  • So libfit offers a family of APIs that work better with event loops.