1. 08 Jul, 2019 5 commits
    • Kenton Varda's avatar
      Move cross-thread async tests into a separate file. · 5d175beb
      Kenton Varda authored
      This commit does not change any of the code.
      
      A subsequent commit will take advantage of this to apply the exact same tests when an EventPort is in use.
      5d175beb
    • Kenton Varda's avatar
    • Kenton Varda's avatar
      Make printStackTraceOnCrash() also register an std::terminate handler. · 55a6731a
      Kenton Varda authored
      For whatever reason, the default termination handler on my machine is no longer printing the exception's `what()` string. It just aborts. That makes debugging hard.
      
      This also means that we can now use `noexcept` in unit tests as a way to make uncaught exceptions abort the process _without_ unwinding, which is especially useful in tests that create threads since they often deadlock during unwind waiting for the thread to finish.
      55a6731a
    • Kenton Varda's avatar
      114e20cc
    • Kenton Varda's avatar
      Extend KJ event loop to support cross-thread events. · 0028d85c
      Kenton Varda authored
      The new `Executor` class provides an interface to run a function on some other thread's EventLoop.
      
      `kj::getCurrentThreadExecutor()` gets a reference to this thread's executor, which can then be exposed to other threads.
      
      When a thread requests execution of a function on another thread, the return value is returned to the requesting thread. The requesting thread may choose to wait synchronously for this return value or -- if the requesting thread has an event loop of its own -- it can get Promise for the eventual result.
      
      Meanwhile, orthogonally, the function can either return a raw result or return a Promise; in the latter case, the Promise is resolved to completion in the executor thread and the final result is sent back to the requesting thread.
      0028d85c
  2. 09 Jun, 2019 1 commit
  3. 19 Aug, 2018 1 commit
  4. 05 Aug, 2018 1 commit
    • Kenton Varda's avatar
      GCC doesn't accept (void) to silence warn_unused_result. · f6df70e5
      Kenton Varda authored
      This is stupid, but the GCC maintainers refused to change it:
      
          https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425
      
      For some reason, KJ's uses of (void) did not warn with GCC 5 but do warn with GCC 7. Supposedly, GCC *never* supported silencing with (void), so there must have been some other bug that caused GCC to fail to trigger the warning previously -- maybe related to the fact that the values being returned are non-trivial types?
      
      C++17 introduces `[[nodiscard]]` which is defined as being squelchable using `(void)`, but we're still on C++14, and KJ_UNUSED_RESULT is a post-declaration attribute so can't be defined in terms of the new C++17 attribute even if the compiler supports it. Sigh.
      f6df70e5
  5. 18 Apr, 2018 1 commit
    • Kenton Varda's avatar
      Implement 'Canceler' for managing side-band promise cancelation. · 0df23c4f
      Kenton Varda authored
      This is necessary when someone other than the promise owner might need to destroy the state a promise is operating on. It comes up when implementing pumpTo() for userland pipes -- cancelling the pump needs to cancel any writes currently passing through the pipe.
      0df23c4f
  6. 25 Oct, 2017 1 commit
  7. 21 Sep, 2017 1 commit
    • Kenton Varda's avatar
      Add WaitScope::poll() and Promise::poll() to pump all events. · ece2a1aa
      Kenton Varda authored
      These are useful in unit tests. Often, some tasks have been queued, and we want to test that a particular thing happens or doesn't happen as a result of those tasks, without actually waiting on any specific promise. We need a way to run the event queue until it is empty. For that, we add WaitScope::poll().
      
      Or, sometimes, we want to check if a specific promise is (or is not!) resolved as a result of the tasks that have been queued so far, but we may not want to actulaly wait() on it for a couple reasons:
      - We may actually want to verify that the promise is *not* resolved by tasks so far. wait()ing on it would be expected to deadlock.
      - We may expect the promise to resolve, but would prefer not to deadlock if it doesn't resolve (we'd rather fail fast).
      
      For this, we add Promise::poll().
      
      There are lots of tests I've written which could be simplified by this, but for now I'm not refactoring any existing tests.
      
      Note that adding these (particularly Promise::poll()) required updating the async framework a bit, in that this is the first case where PromiseNode::onReady() might be called multiple times, or might be canceled without destroying the PromiseNode entirely. Luckily this was not hard to account for. (We still have the rule that get() can only be called once, though.)
      ece2a1aa
  8. 28 Apr, 2017 1 commit
  9. 21 Apr, 2017 1 commit
  10. 07 Apr, 2017 1 commit
  11. 07 Oct, 2016 1 commit
  12. 30 Mar, 2016 1 commit
  13. 01 Feb, 2016 1 commit
  14. 20 May, 2015 1 commit
  15. 30 Dec, 2014 1 commit
  16. 29 Dec, 2014 1 commit
  17. 09 Dec, 2014 1 commit
  18. 20 Jun, 2014 1 commit
    • Kenton Varda's avatar
      Change license to MIT. · 889204fe
      Kenton Varda authored
      For portions currently copyright by Kenton (most of it), transfer copyright to Sandstorm Development Group, Inc. (Kenton's company).
      
      The license change is practically meaningless, as MIT and BSD 2-clause are legally equivalent. However, the BSD 2-clause license is sometimes confused for its ugly siblings, BSD 3-clause and BSD 4-clause. The MIT license is more immediately recognizeable for what it is.
      
      Rémy Blank and Jason Choy (the two non-trivial contributors) are on record as approving this change:
      
      https://groups.google.com/d/msg/capnproto/xXDd2HUOCcc/gbe_COIuXKYJ
      889204fe
  19. 30 Mar, 2014 1 commit
  20. 10 Dec, 2013 1 commit
  21. 07 Dec, 2013 1 commit
  22. 06 Dec, 2013 2 commits
  23. 05 Dec, 2013 2 commits
  24. 04 Dec, 2013 2 commits
  25. 30 Nov, 2013 3 commits
  26. 28 Nov, 2013 1 commit
    • Kenton Varda's avatar
      Revamp concurrency model, part 1: EventLoop no longer allows cross-thread event… · 7921c854
      Kenton Varda authored
      Revamp concurrency model, part 1:  EventLoop no longer allows cross-thread event queuing, simplifying many things.  Capability clients are no longer thread-safe, so they don't have to be so const.  In the future, explicit ways to communicate between threads will be re-added, but threads will be treated more like separate vats that just happen to have a particularly fat pipe.  Upcoming:  Remove mutexes.
      7921c854
  27. 26 Nov, 2013 1 commit
  28. 22 Nov, 2013 1 commit
  29. 19 Nov, 2013 1 commit
  30. 15 Nov, 2013 1 commit
  31. 14 Nov, 2013 1 commit