1. 19 Mar, 2019 5 commits
    • Lewis Baker's avatar
      Add variadic folly::coro::collectAlll() and collectAllTry() · 3874d423
      Lewis Baker authored
      Summary:
      Adds two new functions to folly::coro for concurrently awaiting a fixed number of sub-tasks.
      
      * `folly::coro::collectAll(tasks...)`
      * `folly::coro::collectAllTry(tasks...)`
      
      Both can be used to concurrently await multiple input tasks. The difference is in how they report the results.
      
      `collectAll()` produces a tuple of the result values for each of the input operations. If any of the input operations fails with an exception then the whole operation fails with an exception (which one is unspecified) any successful results are discarded.
      
      `collectAllTry()` produces a tuple of `Try<T>` objects regardless of whether any of the input operations failed with an exception. The individual result objects can then be queried for the success/failure, allowing the caller to handle partial failure and/or determine which operation(s) failed.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D14334714
      
      fbshipit-source-id: 22eb51e2198be42e77677a066bfbc15e1c7eb7dd
      3874d423
    • deryck's avatar
      moved FOLLY_HAVE_SENDMMSG to FollyConfigChecks.cmake for issue #1011 (#1053) · 4fe39e0f
      deryck authored
      Summary:
      Compile error on Linux 2.6.32-754.6.3.el6.x86_64 /gcc 7.4/NetOps.cpp (issue #1011)
      Pull Request resolved: https://github.com/facebook/folly/pull/1053
      
      Reviewed By: Orvid
      
      Differential Revision: D14454590
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 9c4dccfa30291dd0fb830cc2417c17568ae4fde3
      4fe39e0f
    • Matthieu Martin's avatar
      Provide executor getter for ExecutorLoopController · 7e962169
      Matthieu Martin authored
      Summary: This change enables to acquire the executor from the current FiberManager when using ExecutorLoopController (which is already possible to do with the EventBase's loop controller).
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D14515799
      
      fbshipit-source-id: 3b9e48450bf58ea94bebab50dbbcfd7720f90d61
      7e962169
    • Joe Loser's avatar
      Set CMake policy CMP0075 to respect CMAKE_REQUIRED_LIBRARIES (#1066) · 20572588
      Joe Loser authored
      Summary:
      - For CMake 3.12 and above, CMP0075 is available which allows the macro
        `check_include_file`, `check_include_files`, and `check_include_files_cxx`
        to prefer to link the check executable to the libraries listed in the
        `CMAKE_REQUIRED_LIBRARIES` variable.
      - For CMake 3.13.4, not having this policy set results in a warning such
        as the one below.
      
      ```
      CMake Warning (dev) at /usr/local/Cellar/cmake/3.14.0/share/cmake/Modules/CheckIncludeFileCXX.cmake:79 (message):
        Policy CMP0075 is not set: Include file check macros honor
        CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
        details.  Use the cmake_policy command to set the policy and suppress this
        warning.
      
        CMAKE_REQUIRED_LIBRARIES is set to:
      
          Threads::Threads;gflags_shared;/usr/lib/libssl.dylib;/usr/local/Cellar/openssl/1.0.2q/lib/libcrypto.dylib
      
        For compatibility with CMake 3.11 and below this check is ignoring it.
      Call Stack (most recent call first):
        CMake/folly-deps.cmake:144 (CHECK_INCLUDE_FILE_CXX)
        CMakeLists.txt:90 (include)
      This warning is for project developers.  Use -Wno-dev to suppress it.
      ```
      
      - This patch sets the policy to the new behavior which means we will
        honor `CMAKE_REQUIRED_LIBRARIES` in the include file check macros now.
      - The warning is now gone for those using CMake 3.13.4 or later.
      Pull Request resolved: https://github.com/facebook/folly/pull/1066
      
      Reviewed By: Orvid
      
      Differential Revision: D14500811
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 767bafbc6e15099a85cd0a5556e7f50f7c4fd0eb
      20572588
    • Steven Peters's avatar
      Fix macOS 10.14 build: compile hash/detail files with -mpclmul (#1067) · c3c0dbe1
      Steven Peters authored
      Summary:
      The macOS 10.14 build is failing in homebrew with some compilation errors in the hash/detail files:
      
      * https://github.com/Homebrew/homebrew-core/pull/37954
      * https://jenkins.brew.sh/job/Homebrew%20Core%20Pull%20Requests/39386/version=mojave/testReport/junit/brew-test-bot/mojave/install___build_bottle_folly/
      * https://github.com/Homebrew/homebrew-core/pull/35982
      
      ~~~
      /tmp/folly-20190114-14797-1m0rah5/folly-2019.01.07.00/folly/hash/detail/ChecksumDetail.cpp:181:28:
       error: '__builtin_ia32_pclmulqdq128' needs target feature pclmul
          y0 = _mm_xor_si128(y0, _mm_clmulepi64_si128(x0, multipliers_4, 0x00));
                                 ^
      /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.0/include/__wmmintrin_pclmul.h:54:13: note: expanded from macro '_mm_clmulepi64_si128'
        ((__m128i)__builtin_ia32_pclmulqdq128((__v2di)(__m128i)(__X), \
                  ^
      ~~~
      
      I noticed a comment by passy in https://github.com/facebook/flipper/pull/125 referencing this same error message "needs target feature pclmul", and the comment also said that it "should be easily fixable by ensuring that -mpclmul is added to the CFLAGS". I had trouble identifying the system architecture as he suggested, but figured that we could just check if the compiler supports that flag and add it for those specific source files if so.
      
      This fixes the 10.14 build for me. It would be nice to set up CI to keep this build working, but it's difficult to currently set up CI for 10.14 without your own hardware, since travis and azure pipelines only support up to 10.13.
      Pull Request resolved: https://github.com/facebook/folly/pull/1067
      
      Reviewed By: Orvid
      
      Differential Revision: D14500840
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 939fb6d495b05491af6e95adc16a0d0bbe86829f
      c3c0dbe1
  2. 18 Mar, 2019 9 commits
    • Joe Loser's avatar
      Fix shellcheck warnings on docker_build_with_ccache.sh (#1054) · 605b8ede
      Joe Loser authored
      Summary:
      - Fix a few shellcheck warnings on `docker_build_with_ccache.sh`.
      - This will help when new changes are made to this script as
        shellcheck is run internally.
      Pull Request resolved: https://github.com/facebook/folly/pull/1054
      
      Reviewed By: yns88
      
      Differential Revision: D14454554
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: f4b692f21d2478f9db06b478ce56c1ba57fa59e0
      605b8ede
    • Andrii Grynenko's avatar
      Use KeepAlive in co_viaIfAsync · 33421a75
      Andrii Grynenko authored
      Summary: This allows us to always use a dummy keep-alive for all awaitables from coro::Task. We also don't need a custom await_transform for coro::Task anymore.
      
      Reviewed By: lewissbaker
      
      Differential Revision: D14491068
      
      fbshipit-source-id: 0e931c2ae9f52da770b08207e551401e4a3778cb
      33421a75
    • Aaryaman Sagar's avatar
      Remove android debug code · 33cf2370
      Aaryaman Sagar authored
      Summary: Title, remove debugging code that does not seem to be needed anymore
      
      Reviewed By: yfeldblum, davidtgoldblatt
      
      Differential Revision: D14267545
      
      fbshipit-source-id: df57e4b85d850e344b12ce1768a1e1a56ae72bce
      33cf2370
    • Yedidya Feldblum's avatar
      Fix fibers build - Semaphore::future_wait declared but undefined · b7e9f46e
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix fibers build - `Semaphore::future_wait` declared but undefined.
      
      The `#if` guarding related code is overly aggressive.
      
      Reviewed By: Orvid
      
      Differential Revision: D14498252
      
      fbshipit-source-id: 4183fc67fece0e2bdad1fab5c83e7b9a50ae847b
      b7e9f46e
    • Neel Goyal's avatar
      Add BasicTransportCertificate · 72080476
      Neel Goyal authored
      Summary: Add a basic transport cert with only the needed fields.
      
      Reviewed By: knekritz
      
      Differential Revision: D14429070
      
      fbshipit-source-id: 6728310f75a17e3640025f689b69ffcc3f829522
      72080476
    • Jimmy Lu's avatar
      disable conversion warnings in folly/Format · cc4f4f61
      Jimmy Lu authored
      Summary: as title. Disabling -Wconversion since it can be triggered pretty easily. We've run into this a lot in cachelib code. Until now, we've manually disabled -Wconversion around the header for folly/Format.h in our own code. But I think it's much easier just to disable it inside Format-inl.h itself.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14471124
      
      fbshipit-source-id: df6bcbd57cbbdb0e6a762eaa5d11548c9e614e1b
      cc4f4f61
    • Joe Loser's avatar
      Contains with precomputed hash for F14Map and F14Set (#1063) · 5204fe2f
      Joe Loser authored
      Summary:
      - Implement `contains(F14HashToken const& token, key_type const& key)` similar
        to the C++20 `contains(key_type const& key, size_t hash)` interface. Parameter order follows existing F14 interface, even though it differs from the C++20 interface.
      - Implement heterogeneous lookup overloads of `contains` of the above.
      Pull Request resolved: https://github.com/facebook/folly/pull/1063
      
      Reviewed By: nbronson
      
      Differential Revision: D14500835
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 85b0fbb66c2db948958e67105cf8ef98851ee0a6
      5204fe2f
    • Yedidya Feldblum's avatar
      conditional_t · 8a00bcc5
      Yedidya Feldblum authored
      Summary: [Folly] `conditional_t`, like `std::conditional_t` but where the result can be used in deducible contexts.
      
      Reviewed By: nbronson
      
      Differential Revision: D14477367
      
      fbshipit-source-id: d0a9da7f0e1584a45a0709e80e2b8afb2851214c
      8a00bcc5
    • Aaryaman Sagar's avatar
      Remove unused dependency on optional from ParkingLot · 4ffe3aae
      Aaryaman Sagar authored
      Summary: as title
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14476923
      
      fbshipit-source-id: 5ce16adb2402720b16acd12ab0003c1e93395f6c
      4ffe3aae
  3. 17 Mar, 2019 1 commit
  4. 16 Mar, 2019 4 commits
  5. 15 Mar, 2019 4 commits
    • Joe Loser's avatar
      Remove unnecessary typename in F14Table.h (#1056) · 2284a6db
      Joe Loser authored
      Summary:
      - Remove unneeded typename for a using alias in `F14Table.h`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1056
      
      Reviewed By: nbronson
      
      Differential Revision: D14473219
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: a6ac26c42dbca219ce123aff00b1ee7079068007
      2284a6db
    • James Gill's avatar
      Implement c++20 contains method on F14Map and F14Set · 94a77ab3
      James Gill authored
      Summary:
      contains() is part of the c++20 spec.  This implements it, and
      refactors count() to use contains().
      
      Reviewed By: nbronson
      
      Differential Revision: D14426805
      
      fbshipit-source-id: 2435124e9c0a8eeb4e53109f0ddac884c227c781
      94a77ab3
    • James Gill's avatar
      Replace std::size_t return types in F14 to size_type · e57833b0
      James Gill authored
      Summary:
      The heterogenous count() method currently returns size_type, unlike
      similar methods (normal count(), F14Map.count() methods).  This
      standardizes it.
      
      Reviewed By: nbronson
      
      Differential Revision: D14426807
      
      fbshipit-source-id: 140be39fcda99c9f82ced3962ddcbdd1d5f53ba6
      e57833b0
    • Fuat Geleri's avatar
      Folly/Benchmark: Make user counters readable · cd62e86f
      Fuat Geleri authored
      Summary:
      When a user counter is added to benchmarks, the counter's value is written as a bare integer.
      This change gives chance to user to either still keep it reported as bare integer, a time value or a metric value.
      
      Differential Revision: D14451341
      
      fbshipit-source-id: 95e64a89c201bb385d9a403f3442fa70c2ac7e2a
      cd62e86f
  6. 14 Mar, 2019 1 commit
    • Ilya Maykov's avatar
      fix cmake rule for AsyncIOTest · fdf4feab
      Ilya Maykov authored
      Summary: Make AsyncIOTest.cpp conditionally depend on $LIBAIO_FOUND in CMakeLists.txt.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14365682
      
      fbshipit-source-id: 5ac7dc25174ab48ed1de8846956e69c7759fc9bd
      fdf4feab
  7. 13 Mar, 2019 3 commits
    • Kirk Shoop's avatar
      change definition of Executor · 19d7960b
      Kirk Shoop authored
      Summary: convert all executors in pushmi and all executor concepts and usage in pushmi to use `schedule()`
      
      Reviewed By: ericniebler
      
      Differential Revision: D13463902
      
      fbshipit-source-id: 01eac4fe0b5cd49afbd95118db769db59a3b968c
      19d7960b
    • Orvid King's avatar
      Remove AsyncUDPSocket->getFD · ce0fd826
      Orvid King authored
      Summary: It's dead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14425042
      
      fbshipit-source-id: 098de614955eedd7ccc733858db85b997d01d9e0
      ce0fd826
    • Orvid King's avatar
      Add a SemiFuture variant of collect · f8dbfe77
      Orvid King authored
      Summary: At least make it possible to do things correctly.
      
      Reviewed By: yfeldblum, LeeHowes
      
      Differential Revision: D14426753
      
      fbshipit-source-id: 63b3572175224dbbda828981a5c9f067a5e35f33
      f8dbfe77
  8. 12 Mar, 2019 9 commits
    • Dan Melnic's avatar
      Fix typo · 7ecfb621
      Dan Melnic authored
      Summary: Fix typo
      
      Reviewed By: aary
      
      Differential Revision: D14411090
      
      fbshipit-source-id: 4ca0273201facebc815db26d23662d0d192c831f
      7ecfb621
    • Yedidya Feldblum's avatar
      Move FOLLY_DEFINE_CPO to folly/lang/CustomizationPoint.h · ca91b0ed
      Yedidya Feldblum authored
      Summary:
      [Folly] Move `FOLLY_DEFINE_CPO` to `folly/lang/CustomizationPoint.h`.
      
      And move `StaticConst` to top-level `folly` namespace and into `folly/lang/`.
      
      And Americanize the spellings of words in the comments.
      
      Reviewed By: ericniebler, lewissbaker
      
      Differential Revision: D14402315
      
      fbshipit-source-id: e13dbc9d471ee73ba0a289d375c235734334b920
      ca91b0ed
    • Jacob Lacouture's avatar
      Future<Try<T>> -> Future<T> · 4008ab21
      Jacob Lacouture authored
      Summary:
      future.then([] -> T)  currently returns Future<T>
      future.then([] -> Try<T>)  currently returns Future<Try<T>>
      
      This changes that behavior, such that future.then([] -> Try<T>) will
      return Future<T>.
      
      This is a more desirable interface for futures. It also simplifies
      implementation of a separate task (propagating exceptions more
      efficiently through chained callbacks) because it enables us to internally
      substitute lambdas returning T with lambdas returning Try<T>.
      
      Reviewed By: yfeldblum, ryantimwilson
      
      Differential Revision: D14318624
      
      fbshipit-source-id: 51363e82ceb86bfecf87ae661188be9ca3dd8002
      4008ab21
    • Orvid King's avatar
      Remove the fd overload of AsyncUDPServerSocket->getFD() · d10d3f04
      Orvid King authored
      Summary: Instead prefer the NetworkSocket version
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14371075
      
      fbshipit-source-id: 5dfa34e21b360cae987b1ffb1dd5f5ee7b105623
      d10d3f04
    • Joe Loser's avatar
      Use common IsNothrowSwappable in F14Policy.h (#1049) · 5c000f05
      Joe Loser authored
      Summary:
      - Instead of defining our own version of whether a type is nothrow
        swappable, reuse the existing definition from `folly/Traits.h` which
        is spelled `IsNothrowSwappable`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1049
      
      Reviewed By: Orvid
      
      Differential Revision: D14402098
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 5b61bd6d43db939b4499e908b26a3eb61f8929a3
      5c000f05
    • Joe Loser's avatar
      Cut remove_cvref_t from pushmi/traits.h (#1048) · 4e39e4da
      Joe Loser authored
      Summary:
      - Remove `remove_cvref_t` alias template from `pusmhi/traits.h` in favor of
        `folly::remove_cvref_t` from `folly/Traits.h` which is the same
        definition.
      Pull Request resolved: https://github.com/facebook/folly/pull/1048
      
      Reviewed By: ericniebler
      
      Differential Revision: D14402040
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: baba640e5fa410e0c48e666ea004de61b7f12a12
      4e39e4da
    • Joe Loser's avatar
      Replace Not with folly::Negation in PolyDetail.h (#1045) · f52d7dc8
      Joe Loser authored
      Summary:
      - Replace `Not` template alias from `PolyDetail.h` with `folly::Negation` from
       `folly/Traits.h` which does the same thing.
      Pull Request resolved: https://github.com/facebook/folly/pull/1045
      
      Reviewed By: ericniebler
      
      Differential Revision: D14402105
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 100347dbdc159c5217c7452b202650d58d80850c
      f52d7dc8
    • Dan Melnic's avatar
      Add timerfd based timers · ac744ab3
      Dan Melnic authored
      Summary: Add timerfd based timers
      
      Reviewed By: djwatson
      
      Differential Revision: D13809490
      
      fbshipit-source-id: 9ae70d9cc4d481245623efbc3e74ce5ff8c8f3ca
      ac744ab3
    • Yunus Rahbar's avatar
      Fix ShipIt sync · 9f5c7e1e
      Yunus Rahbar authored
      fbshipit-source-id: 4c8ab4cdad047a4311c84b302b28160dd2bc9ed4
      9f5c7e1e
  9. 11 Mar, 2019 4 commits
    • Joe Loser's avatar
      Remove extraneous libfolly.pc.in pkg-config file (#1050) · 3129c365
      Joe Loser authored
      Summary:
      - In `c2e51a8e`, i.e.
        Differential Revision: D9213429
        fbshipit-source-id: 849c0fce01d4903d3f8a7b6d196037bf950e5921
        a `libfolly.pc.in` file was placed in the `CMake` directory so that
        the `libfolly.pc` file is installed during CMake configure time.
      - Note that the `libfolly.pc.in` in the `folly` directory is not
        referenced anywhere in the build tree, and it has been superseded with
        the one in the `CMake` directory. As such, remove it.
      Pull Request resolved: https://github.com/facebook/folly/pull/1050
      
      Reviewed By: calebmarchent
      
      Differential Revision: D14400016
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 4c8ab4cdad047a4311c84b302b28160dd2bc9ed4
      3129c365
    • Yedidya Feldblum's avatar
      Cut glog include in folly/Range.h · 34592733
      Yedidya Feldblum authored
      Summary: [Folly] Cut glog include in `folly/Range.h`.
      
      Reviewed By: meyering
      
      Differential Revision: D14402324
      
      fbshipit-source-id: ed37939d69b2de4016483e7a2564d73892a64b3b
      34592733
    • Matthew Glazar's avatar
      Add missing gflags #include in tests (#1051) · 3e23fe15
      Matthew Glazar authored
      Summary:
      Some tests fail to compile because gflags.h is not included:
      
          .../folly/test/FormatOtherTest.cpp: In function 'int main(int, char**)':
          .../folly/test/FormatOtherTest.cpp:113:3: error: 'gflags' has not been declared
             gflags::ParseCommandLineFlags(&argc, &argv, true);
             ^~~~~~
      
      The tests compile without issue on Travis CI without this patch, but I
      don't see how that's possible.
      
      Include gflags.h explicitly to fix the compilation of these tests.
      Pull Request resolved: https://github.com/facebook/folly/pull/1051
      
      Reviewed By: aary
      
      Differential Revision: D14400709
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 73999a940f45511373d3922ea8eb782a27af0008
      3e23fe15
    • Brandon Schlinker's avatar
      Verify socket open when handling err messages · 45cf4bf2
      Brandon Schlinker authored
      Summary:
      When a socket is configured to read from `MSG_ERRQUEUE`, the corresponding callback handler for `errMessageCallback_->errMessage(*cmsg)` may close the socket when processing a message.
      
      If this happens, `fd_` will be set to -1 (reinitialized) and subsequent calls to `netops::recvmsg(fd_, &msg, MSG_ERRQUEUE)` will fail. On the read failure, an error will be propagated via `failErrMessageRead(__func__, ex)`. This quickly becomes confusing -- you end up with an error message `::recvmsg exited with code 9` (EBADF) with little context.
      
      This diff adds logic to check if the socket is still open before each call to `netops::recvmsg(fd_, &msg, MSG_ERRQUEUE)`. If not, we exit out.
      
      It's arguable that the application is at fault in this scenario instead of the library. However, I've found this problem and given the complexity, it seems like a scenario worth guarding against in the library.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D14354115
      
      fbshipit-source-id: 49e1efbbf6cecbe3bf6db7ee6bdfcac4c8aaa8c2
      45cf4bf2