Skip to content
Snippets Groups Projects
  1. Feb 05, 2021
    • Florian Fischer's avatar
      [IO] add callback support · 827b79ae
      Florian Fischer authored
      Futures can have a registered Callback of type
      std::function<void(const uint32_t&)> which gets called in a new
      Fiber with the result of the IO Request.
      Note the first completion will cause the execution of a callback and
      partial completion support must be implemented manually in the callback.
      
      Callbacks are stored in a heap allocated std::function on registration
      and are freed by the new Fiber after the callback returned;
      
      The Future with a registered Callback is not referenced in any way in
      the IO subsystem and therefore can be dropped after being submitted.
      This also means that a Future with a registered callback will not be
      signaled by the IO subsystem on completion.
      If signaling is desired one must implement it manually in the registered
      callback.
      827b79ae
    • Florian Fischer's avatar
      [test] use gtest meson wrap if gtest is not found · 3790a034
      Florian Fischer authored
      The gtest wrap can be updated with the meson wrap command
      3790a034
    • Florian Schmaus's avatar
  2. Feb 03, 2021
  3. Feb 02, 2021
  4. Jan 29, 2021
  5. Jan 28, 2021
    • Florian Fischer's avatar
      [test] fix occasional failures of SimpleDiskAndNetworkTest · 54dd7ffa
      Florian Fischer authored
      Concurrently connecting and creating the server socket is racy.
      Now the server socket is created before any Fiber is started
      removing this race.
      Note: The same race is theoretically in SimpleNetworkTest and
      ConcurrenctEchoTest too but I haven't observed the failure yet
      54dd7ffa
  6. Jan 26, 2021
    • Florian Schmaus's avatar
    • Florian Fischer's avatar
      [IO] introduce emper::io a IO subsystem using io_uring · 460c2f05
      Florian Fischer authored
      Empers IO design is based on a proactor pattern where each worker
      can issue IO requests through its exclusive IoContext object which wraps an
      io_uring instance.
      
      IO completions are reaped at 4 places:
      1. After a submit to collect inline completions
      2. Before dispatching a new Fiber
      3. When no new IO can be submitted because the completion queue is full
      4. And by a global completer thread which gets notified about completions
         on worker IoContexts through registered eventfds
      
      All IO requests are modeled as Future objects which can be either
      instantiated and submitted manually, retrieved by POSIX-like non-blocking
      or implicitly used by posix-like blocking functions.
      
      User facing API is exported in the following headers:
      * emper/io.hpp (POSIX-like)
      * emper.h (POSIX-like)
      * emper/io/Future.hpp
      
      Catching short write/reads/sends and resubmitting the request without
      unblocking the Fiber is supported.
      
      Using AlarmFuture objects Fibers have a emper-native way to sleep for
      a given time.
      
      IO request timeouts with TimeoutWrapper class.
      Request Cancellation is supported with Future::cancel() or the
      CancelWrapper() Future class.
      
      A proactor design demands that buffers are committed to the kernel
      as long as the request is active. To guaranty memory safety Futures
      get canceled in their Destructor which will only return after the committed
      memory is free to use.
      
      Linking Futures to chains is supported using the Future::SetDependency()
      method. Future are submitted when their last Future gets submitted.
      A linked Request will start if the previous has finished.
      Error or partial completions will cancel the not started tail of a chain.
      
      TODO: Handle possible situations where the CQ of the global completer is full
      and no more sqe can be submitted to the SQ.
      460c2f05
  7. Jan 22, 2021
  8. Jan 14, 2021
  9. Jan 12, 2021
  10. Jan 11, 2021
  11. Dec 18, 2020
  12. Dec 17, 2020
    • Florian Fischer's avatar
      handle UnboundedBlockingMpscQueue spurious wake-ups · 82cf159a
      Florian Fischer authored
      A spurious wake-up can be produced by the new UnblockOnMainActorTest which
      triggers the assert(!mpscQueue.empty()) in UnboundedBlockingMpscQueue::get.
      
      Those spurious wake-ups are possible because the push and wake-up pair in
      UnboundedBlockingMpscQueue::put are not atomic.
      The following sequence diagram demonstrates a spurious wake-up:
      
         T1          T2            Q
         .           .            { }
        put(e)       .            { }
       push 54-57    .            {e}
         .         get()          {e}
         .        consume e       { }
         .           .            { }
         .         get()          { }
         .         block          { }
       unblock       .            { }
         .           .            { }
         .         wakeup         { }
         .           .            { }
                     X
             assert(!queue.Empty())
      
      To deal with spurious wake-ups we recheck the wake-up condition (a non empty queue)
      and block again if we find it empty.
      We assume spurious wake-ups are rare because it was difficult to reproduce them
      even with a dedicated Test (the new UnblockOnMainActorTest) therefore we declare
      the empty queue branch as unlikely.
      
      Fixes #4.
      82cf159a
  13. Dec 10, 2020
  14. Dec 09, 2020
  15. Dec 07, 2020
  16. Dec 01, 2020
    • Florian Schmaus's avatar
      Revert "[tests] don't undef NDEBUG for test executables" · a3b2a501
      Florian Schmaus authored
      This reverts commit b33ac93c.
      
      Now that logging is done independently from NDEBUG, we can re-enable
      "undef NDEBUG for test executables". The rationale that we want to
      undefine NDEBUG for test executable is that we want, even in release
      builds, asserts in tests enabled. Note that this also applies to
      asserts in the emper core library, if those are in *headers*.
      a3b2a501
  17. Nov 30, 2020
    • Florian Fischer's avatar
      [userspace-rcu] make the userspace-rcu dependecy optional · 28ea72ef
      Florian Fischer authored
      Disable the userpace-rcu support by default.
      Our used userspace-rcu flavor memb is rather new and not available in
      liburcu version 0.10 available in debian buster.
      This change switches from using DCE and "if constexpr" to the C
      preprocessor so the library is only needed when the userspace-rcu support
      is actually enabled.
      28ea72ef
  18. Nov 27, 2020
  19. Nov 20, 2020
  20. Nov 19, 2020
    • Florian Fischer's avatar
      [test] add AlarmActorTest · cbe2a880
      Florian Fischer authored
      Introduce a new Actor test using BinaryPrivateSemaphores and an Actor.
      Multiple fibers are created which create a BPS on the stack, submit it to the actor
      and wait on the semaphore.
      The Actor simply signals each semaphore it receives.
      cbe2a880
  21. Nov 17, 2020
  22. Nov 16, 2020
  23. Nov 10, 2020
  24. Nov 05, 2020
Loading