1. 09 Apr, 2019 1 commit
  2. 08 Apr, 2019 6 commits
    • Eric Niebler's avatar
      Simplify constraints on operator co_await for SingleTypedSenders · fab6cad7
      Eric Niebler authored
      Summary: Because of the guard against constraint recursion in the definition of `struct awaitable_sender_traits` (awaitable/concepts.h, line 75), there is no need to be so conservative with the constraints of the generic `operator co_await` for `SingleTypedSender`s.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D14816672
      
      fbshipit-source-id: b2f49588ae98ea63a24f4044692470c59be15e29
      fab6cad7
    • Orvid King's avatar
      Remove the fd overload of EventHandler::EventHandler · 85525f39
      Orvid King authored
      Summary: Things have been ported, time to remove the fd version.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14703143
      
      fbshipit-source-id: 13498d5a4c20d19c30c0d0fe942c5d62bb99aa08
      85525f39
    • Wez Furlong's avatar
      Back out "folly: cmake: enable DistributedMutexTest.cpp" · a96c8c4f
      Wez Furlong authored
      Summary:
      I only enabled this speculatively, but since it quite a heavyweight
      test, it is timing out in the open source build, so let's turn it off again.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D14817162
      
      fbshipit-source-id: 343b021890974e5b92975bdfc7b4fa554d20a703
      a96c8c4f
    • Wez Furlong's avatar
      oss: FindLibEvent.cmake: workaround cmake POLICY annoyances · f39f7560
      Wez Furlong authored
      Summary:
      When pulled in as an external project into an environment
      that has changed the default cmake policy, the trick we're using
      to extract the full library path errors out.  This works around
      that issue by saving the policy settings and then setting them
      how we need them before restoring them after we're done.
      
      refs https://github.com/facebook/folly/issues/1100
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14766991
      
      fbshipit-source-id: e2506bc0aebd9e66bc70b12c4c538c9e034f9f73
      f39f7560
    • Orvid King's avatar
      Shift AsyncPipe to NetworkSocket · a484a114
      Orvid King authored
      Summary:
      Shift AsyncPipe to be backed by NetworkSocket, as the only things this can be used for are listenable to by libevent. At the moment, the APIs for what are listenable to by libevent are all described in terms of NetworkSocket.
      While, by name, this may seem incorrect, in practice, it is correct in function, due to the limitations of how NetworkSocket's are obtainable on Windows, and all existing calls to these functions on posix platforms are already functional by being file descriptor backed.
      The plan is to have this, slightly badly named for the location, interface for the moment, and to clean it up in the future.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14702972
      
      fbshipit-source-id: 785281a7bb9fafc63f5295e33f5bc136b9bc70f1
      a484a114
    • Yedidya Feldblum's avatar
      Lower quadratic iteration count in an elias-fano test · dbff71d2
      Yedidya Feldblum authored
      Summary: [Folly] Lower quadratic iteration count in an elias-fano test to make it take less wall time to run.
      
      Reviewed By: philippv
      
      Differential Revision: D14821341
      
      fbshipit-source-id: 726fe5bd17442661196593ea6279314509622832
      dbff71d2
  3. 07 Apr, 2019 1 commit
  4. 06 Apr, 2019 3 commits
  5. 05 Apr, 2019 11 commits
    • Orvid King's avatar
      Remove fd overload of AsyncServerSocket::useExistingSocket · a89579c3
      Orvid King authored
      Summary: All calls have been converted to the NetworkSocket overload
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13566829
      
      fbshipit-source-id: c6a3b155ffe35534c0297eba7819413e4ce77282
      a89579c3
    • Yedidya Feldblum's avatar
      Cut fbcode_builder dep for thrift on krb5 · 2105cec0
      Yedidya Feldblum authored
      Summary: [Thrift] Cut `fbcode_builder` dep for `thrift` on `krb5`. In the past, Thrift depended on Kerberos and the `krb5` implementation for its transport-layer security. However, Thrift has since migrated fully to Transport Layer Security for its transport-layer security and no longer has any build-time dependency on `krb5`. Clean this up.
      
      Reviewed By: stevegury, vitaut
      
      Differential Revision: D14814205
      
      fbshipit-source-id: dca469d22098e34573674194facaaac6c4c6aa32
      2105cec0
    • Lewis Baker's avatar
      Add folly::coro::collectAll[Try]Range() · 699acb25
      Lewis Baker authored
      Summary:
      Add functions for concurrently awaiting a collection of SemiAwaitable objects.
      
      * `folly::coro::collectAllRange()` takes an InputRange of SemiAwaitable objects and concurrently awaits them, producing a `std::vector` of the results. This will throw an exception if any of the input operations failed with an exception.
      * `folly::coro::collectAllTryRange()` takes an InputRange of SemiAwaitable objects and concurrently awaits them, producing a `std::vector<folly::Try<T>>` containing the results. Failure of individual operations can be determined by inspecting the corresponding `Try` value.
      
      This diff also refactors the existing implementations of `folly::coro::collectAll()` to make use of a new `Barrier` and `BarrierTask` implementation detail rather than using `DetachedInlineTask`, `Baton` and an atomic counter. This allows delaying the start of the child corouines until after all coroutines have been created which was necessary for cases where we didn't know the number of elements in the input range to allow storage for the results to be allocated in a vector before the tasks start producing results.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D14430147
      
      fbshipit-source-id: 5ba4b7cdc3c9b65d1736f14a2d39f7beb6cb82b0
      699acb25
    • Orvid King's avatar
      Remove the fd overload of AsyncServerSocket::getSocket · 1290f5f2
      Orvid King authored
      Summary: It's dead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14191959
      
      fbshipit-source-id: 8cfb68fa8f10b1f847bf6601aec8d869cb9c008d
      1290f5f2
    • Eric Niebler's avatar
      rename many_sender to simply sender · fbc1a619
      Eric Niebler authored
      Summary: To reflect the fact that the concept `SingleSender` is a refinement of `Sender` (there is no "`ManySender`"), rename `(any_)?(flow_)?many_sender` to `(any_)?(flow_)?sender`.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D14803648
      
      fbshipit-source-id: 5987ebe5ba877d0a3ab38e84b036f97302bcc70b
      fbc1a619
    • Eric Niebler's avatar
      reorganize pushmi headers · bb73ffc6
      Eric Niebler authored
      Summary:
      The pushmi library has grown to the point where a little more structure would aid comprehensibility.
      
      Also, finer-grained headers and build targets would make it easier for downstream projects to include only what they absolutely need.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D14802895
      
      fbshipit-source-id: 8d253f97c5d0529530cc3b7110505000f513ce83
      bb73ffc6
    • Adam Norton's avatar
      Avoid executor re-queue in collect[All]SemiFuture · 8e5c2b92
      Adam Norton authored
      Summary:
      This is a performance optimization to avoid an executor re-queue for the collect[All] continuations which just move the result.
      
      The biggest problem with this now is that these futures are often on a thread pool backed with a blocking MPMCQueue which means the add can potentially deadlock. This diff is not meant as a true fix to the problem though; just an improvement.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14754908
      
      fbshipit-source-id: e533bfa6b9d2d820d50422b612c1489b560ec9d5
      8e5c2b92
    • Yedidya Feldblum's avatar
      PriorityUnboundedBlockingQueue · 4fa5101b
      Yedidya Feldblum authored
      Summary: [Folly] `PriorityUnboundedBlockingQueue`, paralleling `UnboundedBlockingQueue` and `PriorityLifoSemMPMCQueue`.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D14536886
      
      fbshipit-source-id: b3ea04c3f67d3e1e9d80626d963be70de1ae79ba
      4fa5101b
    • Yedidya Feldblum's avatar
      Cut traits for old-ABI std::basic_string · d48cea50
      Yedidya Feldblum authored
      Summary: [Folly] Cut traits for old-ABI `std::basic_string` under libstdc++.
      
      Reviewed By: pixelb
      
      Differential Revision: D14764155
      
      fbshipit-source-id: fa4991f4b70fb407672212886c84f1be4c33581f
      d48cea50
    • Lee Howes's avatar
      Add executor-taking forms of deferValue and thenValue · c316166d
      Lee Howes authored
      Summary: For consistency adds thenExValue and deferExValue.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14793864
      
      fbshipit-source-id: 700f02cfb27b93e1739c511f01142c30c1896990
      c316166d
    • Chad Austin's avatar
      fix dynamic linking of stats on macOS · 57cc7e45
      Chad Austin authored
      Summary:
      D14531266 defaulted static linking on macOS because of a link error in
      folly/stats. A better fix for the issue is instantiating the
      subclasses of BufferedStat, so add those.
      
      Reviewed By: andrewjcg
      
      Differential Revision: D14767345
      
      fbshipit-source-id: eaa597dec468264595547f338348d7d74b49dd69
      57cc7e45
  6. 04 Apr, 2019 7 commits
    • Lee Howes's avatar
      Rename defer for an executor-taking continuation deferExTry for consistency with thenExTry · a9ab61b4
      Lee Howes authored
      Summary: Renames defer taking an executor-taking continuation to deferExTry and modifying to take a KeepAlive for consistency with thenExTry.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14761230
      
      fbshipit-source-id: af95afabb662197edcf2eeb432bc64c57011c776
      a9ab61b4
    • Eric Niebler's avatar
      make awaitables sender and make single-typed senders awaitable · dad6c2b8
      Eric Niebler authored
      Summary:
      Add coroutine support to pushmi by making all sender types that satisfy the `SingleTypedSender` concept awaitable; that is, you can get their result by `co_await`-ing them in a coroutine.
      
      In addition, all Awaitable types automatically satisfy the `SingleTypedSender` concept; that is, you can pass them to `pushmi::submit` along with a `Receiver` that is invoked with the result of `co_await`-ing the awaitable.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D14688373
      
      fbshipit-source-id: 8598b303aebcaa070033868abd440245c165bd73
      dad6c2b8
    • Eric Niebler's avatar
      replace receiver properties with receiver_traits · 432d4332
      Eric Niebler authored
      Summary: Types opt in to receiver-ness with pushmi::receiver_traits, analogous to sender_traits (and std::iterator_traits). Alternatively, they can simply define a nested ::receiver_concept typedef that is an alias for one of "sink" or "flow".
      
      Reviewed By: kirkshoop
      
      Differential Revision: D14668335
      
      fbshipit-source-id: 230abfcffef0cd231196b5f6a7ed05e1ac86ef0c
      432d4332
    • Eric Niebler's avatar
      add TypedSender support to pushmi, pave the way for Awaitable senders · 1c1fbc3c
      Eric Niebler authored
      Summary:
      * The sender concepts are now defined in terms of a `sender_traits` class template, in which the user can specify additional sender metadata like what values and errors it sends to the Receiver. This will make it possible to automatically make Senders awaitable from within coroutines.
      
      * Remove the now-unused is_sender<>, is_single<>, and is_many<> properties.
      
      * Define a `SingleSender` concept and a `TypedSender` concept.
      
      * Define a `pushmi::sender` class template from which a Sender can inherit to declare the sender category (single/many/flow), and the types of the values and errors.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D14631770
      
      fbshipit-source-id: afcfd10bcd4e0e7ba224ea2c713d7fa92249ab7f
      1c1fbc3c
    • Andrii Grynenko's avatar
      Add a comment. · 7bcdd925
      Andrii Grynenko authored
      Reviewed By: lbrandy
      
      Differential Revision: D14766712
      
      fbshipit-source-id: 78c84117aa1c35825c72eb4bcd04e0bebb20c67f
      7bcdd925
    • Lee Howes's avatar
      Add thenExTry operation to support continuations taking executor parameter. · a6c3395f
      Lee Howes authored
      Summary: Adds the option of providing a continuation that takes an executor and a Try. This way an executor is always available to child tasks. Uses a separate thenExTry API to avoid potential overload set ambiguity.
      
      Reviewed By: yfeldblum, andriigrynenko
      
      Differential Revision: D14726443
      
      fbshipit-source-id: ab635c502c8a010b9b68af38add86ff7c200ff38
      a6c3395f
    • Yang Chi's avatar
      HHWheelTimer::Callback getTimeRemaining function is const · ea225c31
      Yang Chi authored
      Summary: it doesn't change any state
      
      Reviewed By: siyengar
      
      Differential Revision: D14296359
      
      fbshipit-source-id: 0bb8acd1a55f2b6ed431adcd54b97e76b8f377f6
      ea225c31
  7. 03 Apr, 2019 5 commits
    • Andrii Grynenko's avatar
      Fix collectSemiFuture and collectN to work with SemiFutures with deferred work · d0494141
      Andrii Grynenko authored
      Reviewed By: yfeldblum
      
      Differential Revision: D14719902
      
      fbshipit-source-id: d3bc7b61d666c796c3c19f7fa198252acb472970
      d0494141
    • Amol Bhave's avatar
      Make InlineFunctionRef work for 32-bit · 869662db
      Amol Bhave authored
      Summary:
      InlineFuctionRef fails to compile on 32-bit machines and fails the
      static assert. This diff makes the assert generic to add support for 32-bit as
      well.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14752182
      
      fbshipit-source-id: eb00487248c93c6c32226cb227e8d119bcc7af7a
      869662db
    • Stepan Palamarchuk's avatar
      Avoid atomic operation on the last refcount · e8751dea
      Stepan Palamarchuk authored
      Summary:
      There's no need in the atomic refcount decrement from 1->0, because we're the last live reference and using it to bump 1->2 is already undefined behavior.
      
      Added benchmark:
      
      Before:
      ```
      stepan@devvm329:~/fbsource/fbcode$ buck-out/opt/gen/folly/io/test/iobuf_benchmark --bm_min_usec=1000000
      ============================================================================
      folly/io/test/IOBufBenchmark.cpp                relative  time/iter  iters/s
      ============================================================================
      createAndDestroy                                            36.35ns   27.51M
      cloneOneBenchmark                                           40.40ns   24.75M
      cloneOneIntoBenchmark                                       27.03ns   37.00M
      cloneBenchmark                                              42.23ns   23.68M
      cloneIntoBenchmark                                          28.35ns   35.27M
      moveBenchmark                                               15.20ns   65.79M
      copyBenchmark                                               35.00ns   28.57M
      cloneCoalescedBaseline                                     334.59ns    2.99M
      cloneCoalescedBenchmark                          660.01%    50.69ns   19.73M
      takeOwnershipBenchmark                                      50.57ns   19.78M
      ============================================================================
      ```
      
      After:
      ```
      stepan@devvm329:~/fbsource/fbcode$ buck-out/opt/gen/folly/io/test/iobuf_benchmark --bm_min_usec=1000000
      ============================================================================
      folly/io/test/IOBufBenchmark.cpp                relative  time/iter  iters/s
      ============================================================================
      createAndDestroy                                            30.04ns   33.29M
      cloneOneBenchmark                                           41.27ns   24.23M
      cloneOneIntoBenchmark                                       26.37ns   37.92M
      cloneBenchmark                                              43.91ns   22.77M
      cloneIntoBenchmark                                          28.49ns   35.10M
      moveBenchmark                                               15.50ns   64.52M
      copyBenchmark                                               35.85ns   27.89M
      cloneCoalescedBaseline                                     318.49ns    3.14M
      cloneCoalescedBenchmark                          643.69%    49.48ns   20.21M
      takeOwnershipBenchmark                                      45.15ns   22.15M
      ============================================================================
      ```
      
      Reviewed By: yfeldblum, davidtgoldblatt
      
      Differential Revision: D14715579
      
      fbshipit-source-id: 3c0373b8423dda680920860979cfa240bf3d8d7a
      e8751dea
    • Stepan Palamarchuk's avatar
      Add an API that avoids unnecessary cloning of small IOBufs · 5c133249
      Stepan Palamarchuk authored
      Summary:
      `IOBufQueue` has packing logic, that would copy data instead of chaining `IOBufs`. However, that API unnecessary requires exclusive ownership of the chain.
      
      This diff adds an API that takes reference to IOBuf, copies as much as necessary and then clones/chains the rest.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14715581
      
      fbshipit-source-id: e047d1c69ca19eec95a7adbca6df740440d23db3
      5c133249
    • Wez Furlong's avatar
      folly: workaround AlignedSysAllocator vs Dual ABI issue with gcc · 22152742
      Wez Furlong authored
      Summary:
      `AlignedSysAllocator` doesn't implement the optional `rebind`
      or `size_type` portions of the C++ allocator concept.  This is ok
      in GCC if the C++11 ABI is in use but causes compilation to fail
      with errors like these:
      
      ```
      folly/Range.h: In instantiation of ‘void folly::Range<Iter>::res
      et(folly::Range<Iter>::string<Alloc>&) [with Alloc = folly::AlignedSysAllocator<char>; Iter = const char*; folly::Range<Iter>::string<Alloc> = std::
      basic_string<char, std::char_traits<char>, folly::AlignedSysAllocator<char> >]’:
      folly/test/RangeTest.cpp:235:18:   required from here
      folly/Range.h:420:27: error: ‘folly::Range<const char*>::string<
      folly::AlignedSysAllocator<char> >’ {aka ‘const class std::basic_string<char, std::char_traits<char>, folly::AlignedSysAllocator<char> >’} has no me
      mber named ‘size’
           reset(str.data(), str.size());
                             ~~~~^~~~
      ```
      
      This diff works around this issue by only compiling in the problematic
      test if the C++11 ABI is enabled.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14702585
      
      fbshipit-source-id: ea0c5fcfb0d69994d2958c2c236fe002959c824d
      22152742
  8. 02 Apr, 2019 6 commits
    • Joe Loser's avatar
      Use remove_cvref_t in Future-inl.h (#1099) · 8410273e
      Joe Loser authored
      Summary:
      - Replace a wordy type alias in `Future-inl.h` to use `remove_cvref_t`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1099
      
      Differential Revision: D14721023
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: e9de76a851162163046dfa088a8cc7e5a075562c
      8410273e
    • Orvid King's avatar
      Remove a bunch of to/fromFd calls on NetworkSockets in Folly · 45374fbd
      Orvid King authored
      Summary: The eventual plan will ban the use of `to/fromFd` on `NetworkSocket` when compiling on Windows.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14592244
      
      fbshipit-source-id: cbf965f6822cbd5b6b1098c7dab9ab65aafd8192
      45374fbd
    • Stepan Palamarchuk's avatar
      Slight optimization of append logic · e941e2e0
      Stepan Palamarchuk authored
      Summary:
      1) There's no need to exit the loop if we encounter and IOBuf of length 0.
      2) We should do `n <= tailroom()` instead of `n < tailroom()`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14715582
      
      fbshipit-source-id: 9a30454bd536929414f7c9013dbcf6e59e6e7f2c
      e941e2e0
    • Wez Furlong's avatar
      folly: cmake: enable DistributedMutexTest.cpp · 6a9e877e
      Wez Furlong authored
      Summary:
      was trying to see if I could repro the issue described here:
      
      Refs: https://github.com/facebook/folly/issues/1092
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14702579
      
      fbshipit-source-id: d90cbf5742883a26d9ac5dbfd56eed1965cbc64e
      6a9e877e
    • Wez Furlong's avatar
      folly: remove warning->error promotion from cmake build · 78fab0fb
      Wez Furlong authored
      Summary:
      Running down various warning/error issues is proving
      to be a tiresome game of wackamole.   Here's the latest issue:
      
      ```
      folly/container/test/F14TestUtil.h:400:16: error: ?void* mem
            std::memcpy(p, &n, sizeof(std::size_t));
            ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      In file included from /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_algobase.h:64,
                        from /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/char_traits.h:39,
                        from /opt/rh/devtoolset-8/root/usr/include/c++/8/string:40,
                        from /opt/rh/devtoolset-8/root/usr/include/c++/8/stdexcept:39,
                        from /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/shipit/folly/folly/container/F14Map.h:30,
                        from /data/users/wez/scratch/dataZusersZwezZfbsource/fbcode_builder_getdeps/shipit/folly/folly/container/test/F14MapTest.cpp:17
      /opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_pair.h:198:12: note: ?struct std::pair<const std::basic_string<char>, int>? declared here
            struct pair
                  ^~~~
      ```
      
      The targeted solution is to use `-Wno-class-memaccess` as we do with our
      internal builds, but that is a gcc-specific option that fails when used with
      the apple clang compiler.
      
      The simplest option is just to disable warning->error promotion in
      the cmake build, as it feels like a losing battle to keep chasing
      the different combinations/permutations.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14702575
      
      fbshipit-source-id: d8daa6c9588e7c84c991a0ef86baf700bd32fe8c
      78fab0fb
    • Wez Furlong's avatar
      folly:wangle: centralize FindGMock.cmake · 638a7454
      Wez Furlong authored
      Summary:
      move the FindGMock to the common cmake library and adjust
      folly and wangle to consume it from there.
      
      Reviewed By: strager
      
      Differential Revision: D14710329
      
      fbshipit-source-id: 35ac9d6d2ec03468f389f5b9f1c126b007c7c798
      638a7454