1. 08 Jul, 2019 3 commits
    • Kenton Varda's avatar
    • Kenton Varda's avatar
      536e20e8
    • 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. 01 Jul, 2019 2 commits
  3. 30 Jun, 2019 2 commits
  4. 28 Jun, 2019 2 commits
    • Kenton Varda's avatar
      Merge pull request #855 from capnproto/empty-mmap · 9c7ba5f4
      Kenton Varda authored
      Fix filesystem API: Empty mmaps should succeed.
      9c7ba5f4
    • Kenton Varda's avatar
      Fix filesystem API: Empty mmaps should succeed. · 97673947
      Kenton Varda authored
      I had a snarky comment in the Windows code being annoyed that mapping an empty file was documented to fail... but it turns out zero-length mappings fail on Linux, too. Also my work-around on Windows didn't work (but was never tested).
      
      This PR fixes both.
      
      This was prompted by @KubaO observing that `capnp compile` on an empty source file failed with a cryptic mmap error.
      
      Closes #854, @KubaO's attempt at fixing this, since the correct fix is in the filesystem API, not in the compiler.
      97673947
  5. 27 Jun, 2019 5 commits
  6. 26 Jun, 2019 4 commits
  7. 22 Jun, 2019 1 commit
  8. 21 Jun, 2019 4 commits
  9. 20 Jun, 2019 3 commits
  10. 19 Jun, 2019 3 commits
  11. 18 Jun, 2019 11 commits
    • Kenton Varda's avatar
      Disallow initializing `Maybe<T>` from `T*`. · cded1f89
      Kenton Varda authored
      I think I imagined once upon a time that this would be a convenient way to deal with external interfaces that like to return nullable pointers. However, in practice it is used nowhere in KJ or Cap'n Proto, and it recently hid a bug in my code where I had assigned a `Maybe<T>` from an `Own<T>`. We can introduce a `fromNullablePointer()` helper or something if that turns out to be useful.
      cded1f89
    • Kenton Varda's avatar
      Really fix -Wall build. · f94b1a6f
      Kenton Varda authored
      f94b1a6f
    • Kenton Varda's avatar
      e2094eed
    • Kenton Varda's avatar
    • Kenton Varda's avatar
    • Kenton Varda's avatar
      Fix C++14 build. · ca0e85ce
      Kenton Varda authored
      ca0e85ce
    • Kenton Varda's avatar
      3ef62d15
    • Kenton Varda's avatar
      Fix typos. · 90667fbd
      Kenton Varda authored
      90667fbd
    • Kenton Varda's avatar
      CapabilityServerSet::getLocalServer() must wait for stream queue. · 4a4fe65c
      Kenton Varda authored
      Consider a capnp streaming type that wraps a kj::AsyncOutputStream.
      
      KJ streams require the caller to avoid doing multiple writes at once. Capnp streaming conveniently guarantees only one streaming call will be delivered at a time. This is great because it means the app does not have to do its own queuing of writes.
      
      However, the app may want to use a CapabilityServerSet to unwrap the capability and get at the underlying KJ stream to optimize by writing to it directly. However, before it can issue a direct write, it has to wait for all RPC writes to complete. These RPC writes were probably issued by the same caller, before it realized it was talking to a local cap. Unfortunately, it can't just wait for those calls it issued to complete, because streaming flow control may have made them appear to complete long ago, when they're actually still in the server's queue. How does the app make sure that the directly-issued writes don't overlap with RPC writes?
      
      We can solve this by making CapabilityServerSet::getLocalServer() delay until all in-flight stream calls are complete before unwrapping.
      
      Now, the app can simply make sure that any requests it issued over RPC in the past completed before it starts issuing direct requests.
      4a4fe65c
    • Kenton Varda's avatar
      Implement client RPC side of streaming. · 7a0e0fd0
      Kenton Varda authored
      7a0e0fd0
    • Kenton Varda's avatar
      Add client-side streaming hooks. · 56493100
      Kenton Varda authored
      Also, push harder on the code generator such that `StreamResult` doesn't show up in generated code at all.
      
      So now we have `StreamingRequest<Params>` which is like `Request<Params, Results>`, and we have `StreamingCallContext<Params>` which is like `CallContext<Params, Results>`.
      56493100