1. 10 Jan, 2018 7 commits
    • Yedidya Feldblum's avatar
      Timed wait operations for spin-only Baton · 3579ddb4
      Yedidya Feldblum authored
      Summary:
      [Folly] Timed wait operations for spin-only `Baton`.
      
      Enables `try_wait_for` and `try_wait_until` for `Baton</* MayBlock = */ false, /*...*/>`.
      
      Reviewed By: nbronson
      
      Differential Revision: D6672153
      
      fbshipit-source-id: 95da07260b21c2b88b8f7bf81cbfcbe5f5099ac0
      3579ddb4
    • Adam Simpkins's avatar
      logging: include file name suffixes in XLOG() category names · d056738b
      Adam Simpkins authored
      Summary:
      Update `getXlogCategoryNameForFile()` to keep the file name suffix (e.g., `.h`
      or `.cpp`) in the category name.  Previously the code had stripped this out.
      However it seems worth leaving it in:
      - This makes it possible to independently control log levels for messages from
        the header file vs the cpp file.
      - This makes the category name logic slightly easier to explain to users.
      
      The documents I added in D6525997 already describe this new category name
      selection behavior.  This change updates the code to match the documented
      behavior.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6690464
      
      fbshipit-source-id: 9af6b549d084bd900f788a08e9213e82579b664a
      d056738b
    • Adam Simpkins's avatar
      logging: add numbered INFO* log level values · 59f59178
      Adam Simpkins authored
      Summary:
      Define INFO0 through INFO9 levels for users that want to have finer-grained
      control over info log messages.
      
      This also renumbers the DBG log levels slightly so that there are exactly 1000
      levels between each major log level step.  This renumbering change should not
      affect any code behavior, since these level values are primarily used in memory
      and aren't saved persistently anywhere.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6690466
      
      fbshipit-source-id: acd499cff6830a1d1b579f295bd4b2bac93b5ada
      59f59178
    • Adam Simpkins's avatar
      logging: rename the `DEBUG` log level to `DBG` · 24d6b776
      Adam Simpkins authored
      Summary:
      I ran into some open source projects that define `DEBUG` as a preprocessor
      macro on the compiler command line.  (They effectively defined it as the
      opposite of `NDEBUG`.)  Doing some Google searches revealed that there are a
      number of projects that appear to use this as a macro.
      
      Therefore this diff renames the `DEBUG` log level enum value to `DBG` to avoid
      potentially conflicting with projects that do use `DEBUG` as a macro name.
      
      I did keep the behavior that `logLevelToString()` returns "DEBUG" for an input
      of `LogLevel::DBG`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6690465
      
      fbshipit-source-id: 35bb1698afb45eb670e60c192f21390cbf09331d
      24d6b776
    • Giuseppe Ottaviano's avatar
      Change the enumerate() example to bind the proxy by reference · 489eeb1c
      Giuseppe Ottaviano authored
      Summary:
      When compiling without optimizations binding the proxy by
      reference is slightly faster (no differences in opt mode), so change
      the documentation to recommend this syntax.
      
      The proxy can still be bound by `auto`, `const auto`, and `const
      auto&`, in all case behaving as expected and with no overhead in opt
      mode. Added a test to make sure these all work.
      
      Reviewed By: yfeldblum, luciang
      
      Differential Revision: D6688958
      
      fbshipit-source-id: 7c6b460a01708786bda7614546fa2e1667f27299
      489eeb1c
    • Giuseppe Ottaviano's avatar
      Improve performance of enumerate() with optimization disabled · 66c782bb
      Giuseppe Ottaviano authored
      Reviewed By: yfeldblum, WillerZ
      
      Differential Revision: D6682606
      
      fbshipit-source-id: 5a203a849e96d3020cf9ad2669451122954c2199
      66c782bb
    • Adriana Libório's avatar
      Fixing typo in sorted_vector_types.h · 80d1c0e1
      Adriana Libório authored
      Summary:
      title
      
      Created from Diffusion's 'Open in Editor' feature.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: Sushisugre
      
      Differential Revision: D6688367
      
      fbshipit-source-id: 6e2f2d3fcb897fe78c1caef841515856b1f2bd42
      80d1c0e1
  2. 09 Jan, 2018 4 commits
    • Dan Melnic's avatar
      Return if we handle any error messages to avoid unnecessarily calling recv/send · 2a4ad2c8
      Dan Melnic authored
      Summary: Return if we handle any error messages to avoid unnecessarily calling recv/send
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6677314
      
      fbshipit-source-id: 21f724bb2c92b954888ba97bf7820d72decd2775
      2a4ad2c8
    • Dave Watson's avatar
      use in futex · ee1a988d
      Dave Watson authored
      Summary: Use new ParkingLot API in futex.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6595853
      
      fbshipit-source-id: 7024ac1d3e0c5958a651a3e33c1427038bbe7808
      ee1a988d
    • Dave Watson's avatar
      Add a check if max atomic_shared_ptrs is reached. · 6824c36b
      Dave Watson authored
      Summary:
      Batching reference counts reduces the maximum number of atomic_shared_ptrs
      available to the system (and also shared_ptrs).
      
      Add a check, test, and some comments about it.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5916291
      
      fbshipit-source-id: 0bbf7b43284d94a304201219883c82b3654c1585
      6824c36b
    • Maged Michael's avatar
      UnboundedBlockingQueue: Adjust segment size · 4591832b
      Maged Michael authored
      Summary: Adjust the segment size of the `UnboundedQueue` to 64 instead of 256, a size more suitable for CPUThreadPoolExecutor::CPUTask elements.
      
      Reviewed By: djwatson
      
      Differential Revision: D6665918
      
      fbshipit-source-id: c34c4fa936ee5c6d6a3dd4489129c936369f3980
      4591832b
  3. 08 Jan, 2018 5 commits
    • Eric Niebler's avatar
      give all folly exception types default visibility · f842b713
      Eric Niebler authored
      Summary: This makes sure that whether folly is statically or dynamically linked, all folly exception types will have exactly one definition, and one set of type information.
      
      Reviewed By: mzlee
      
      Differential Revision: D6671431
      
      fbshipit-source-id: 1c06826a05f87cbf9af747c9abdb5f524744d054
      f842b713
    • Keith Daigle's avatar
      Update cpuid test to expect failure on non intel cpu · 24f2ac23
      Keith Daigle authored
      Summary: Found that testing would fail on aarch64 since mmx is an Intel thing.  Changed it to just check for x64.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6670050
      
      fbshipit-source-id: 6ce4b45bb5ef02d65305636d6ac28be7631ddf1b
      24f2ac23
    • Chad Austin's avatar
      test that _sp includes nul bytes · 3df17628
      Chad Austin authored
      Summary:
      D6617812 wants to build a StringPiece from a literal with an
      embedded nul. Add a test to verify that _sp is suitable for this use
      case.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6651024
      
      fbshipit-source-id: be4fb875762829fdb61c57fa72954fef286e9df0
      3df17628
    • Neel Goyal's avatar
      Use local error buffer in readStoreFromBuffer · 5eda6650
      Neel Goyal authored
      Summary: ERR_error_string will use a static buffer if none is provided.  This is unsafe in threaded envs when we build a string out of it later.  Switch this to use ERR_error_string_n
      
      Reviewed By: yfeldblum, knekritz
      
      Differential Revision: D6664958
      
      fbshipit-source-id: 2071347373ac61ebc28296fa66845cd718172b5e
      5eda6650
    • Yedidya Feldblum's avatar
      Remove gcc-v4.7 support from MemoryIdler · 1374bb3a
      Yedidya Feldblum authored
      Summary:
      [Folly] Remove gcc-v4.7 support from `MemoryIdler`.
      
      As of gcc-v4.8, `std::is_trivial<std::chrono::duration<Rep, Period>>::value` holds. We no longer need any extra support.
      
      Reviewed By: meyering
      
      Differential Revision: D6673517
      
      fbshipit-source-id: f28b2d126f113547ebf36c85f9fa37a5d944d65b
      1374bb3a
  4. 07 Jan, 2018 1 commit
    • Yedidya Feldblum's avatar
      Terminal comma for FutexResult enumerators · 7462c4c2
      Yedidya Feldblum authored
      Summary: [Folly] Terminal comma for `FutexResult` enumerators. Style nit.
      
      Reviewed By: meyering
      
      Differential Revision: D6673523
      
      fbshipit-source-id: abf9f4d3e99bf9a6d3042a49252b1b1190e69b9f
      7462c4c2
  5. 06 Jan, 2018 3 commits
    • Yedidya Feldblum's avatar
      Use auto for scope-guard locals v.s. folly::ScopeGuard · 46563373
      Yedidya Feldblum authored
      Summary: Use `auto` for scope-guard locals v.s. `folly::ScopeGuard`.
      
      Reviewed By: igorsugak, meyering
      
      Differential Revision: D6664915
      
      fbshipit-source-id: ea239b712f3f9dc7ef81105aaf82f4b36bc07db5
      46563373
    • Eric Niebler's avatar
      give EventBase a non-explicit default constructor · cacdd1d5
      Eric Niebler authored
      Summary: Default constructors are strange and often unexpected. Refactor.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6667480
      
      fbshipit-source-id: 24c456c46c846c61e28f1a88806d7c36d9192493
      cacdd1d5
    • Maged Michael's avatar
      Add threshold for thread local retired objects · 42452e30
      Maged Michael authored
      Summary: Change the threshold for pushing privately held retired object to the domain to a moderate constant instead of using the threshold for bulk reclamation which is too high for this purpose.
      
      Reviewed By: djwatson
      
      Differential Revision: D6665904
      
      fbshipit-source-id: 0b090884843b0296a93af7994f7183f41c00000e
      42452e30
  6. 05 Jan, 2018 10 commits
    • Yedidya Feldblum's avatar
      Synchronized::exchange · 881088fc
      Yedidya Feldblum authored
      Summary:
      [Folly] `Synchronized::exchange`, for assigning a new value and returning the old value.
      
      (Note: this ignores all push blocking failures!)
      
      Differential Revision: D6653482
      
      fbshipit-source-id: 68f4bd330bc2cf37bb92aff98b8ce3221334112e
      881088fc
    • Yedidya Feldblum's avatar
      Fix copyright lines in folly/synchronization/Baton.h · 18b6a2dd
      Yedidya Feldblum authored
      Summary: [Folly] Fix copyright lines in `folly/synchronization/Baton.h`.
      
      Reviewed By: meyering
      
      Differential Revision: D6665595
      
      fbshipit-source-id: 84aa0c475f01c858d543a047103437c083b3a4ed
      18b6a2dd
    • Mingtao Yang's avatar
      Clarify folly::ssl::init documentation · 64c5a213
      Mingtao Yang authored
      Summary: Adds wording indicating that it is safe to call this function multiple times.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6625530
      
      fbshipit-source-id: 2305f7b8e3451a6663003d23230b22c6f65a3729
      64c5a213
    • Yedidya Feldblum's avatar
      Cut glog include from folly/synchronization/RWSpinLock.h · 5cb23840
      Yedidya Feldblum authored
      Summary: [Folly] Cut `glog` include from `folly/synchronization/RWSpinLock.h`.
      
      Reviewed By: meyering
      
      Differential Revision: D6659300
      
      fbshipit-source-id: 0f1b79d98be0656694f57667252a16acd54e2414
      5cb23840
    • Yedidya Feldblum's avatar
      Move folly/RWSpinLock.h to folly/synchronization/ · 5be3abd7
      Yedidya Feldblum authored
      Summary: [Folly] Move `folly/RWSpinLock.h` to `folly/synchronization/`.
      
      Reviewed By: elsteveogrande
      
      Differential Revision: D6659265
      
      fbshipit-source-id: 307723e22f42ceb104f26657aed8b34f7e183afb
      5be3abd7
    • Yedidya Feldblum's avatar
      Extract WaitOptions · 183fc6b4
      Yedidya Feldblum authored
      Summary:
      [Folly] Extract `WaitOptions` from `SaturatingSemaphore`.
      
      This type may prove useful in the future for a variety of similar cases, and so does not need to be locked up inside `SaturatingSemaphore`.
      
      Additionally:
      * Extract and redraft a comment from `Baton`.
      * Rename `pre_block` to `spin_max`.
      
      Reviewed By: djwatson, aary
      
      Differential Revision: D6632875
      
      fbshipit-source-id: 6b7faeeb6e1ac2011a037c2b560def0ee2e9f3d4
      183fc6b4
    • Yedidya Feldblum's avatar
      Move folly/BitIterator.h to folly/container/ · f6ed4a26
      Yedidya Feldblum authored
      Summary: [Folly] Move `folly/BitIterator.h` to `folly/container/`.
      
      Reviewed By: djwatson
      
      Differential Revision: D6648357
      
      fbshipit-source-id: 5617e3210f58435fcbf3ef07fa745da47dbce475
      f6ed4a26
    • Yedidya Feldblum's avatar
      Move InPlaceConstruction test in folly/test/SynchronizedTest.cpp · d41f4cc9
      Yedidya Feldblum authored
      Summary: [Folly] Move `InPlaceConstruction` test in `folly/test/SynchronizedTest.cpp`.
      
      Differential Revision: D6653481
      
      fbshipit-source-id: f0eadfd6c2f41e9f597a666d01e40d5553447c70
      d41f4cc9
    • Yedidya Feldblum's avatar
      Fix copyright lines for folly/Synchronized.h · 7ce61a15
      Yedidya Feldblum authored
      Summary: [Folly] Fix copyright lines for `folly/Synchronized.h`.
      
      Reviewed By: meyering
      
      Differential Revision: D6664326
      
      fbshipit-source-id: 71a0fc17358e41dfc751b8bcb0736c288975a4a0
      7ce61a15
    • Neel Goyal's avatar
      Add utility to create stores · 79c30edd
      Neel Goyal authored
      Summary: Add methods to create a X509StoreUniquePtr from a ca file or buffer.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6662538
      
      fbshipit-source-id: 646f61596f2787756b2fa5998a43f36d75a91d90
      79c30edd
  7. 04 Jan, 2018 1 commit
    • Keith Daigle's avatar
      Make FOLLY_HAS_COROUTINES dependent on header · c60784b8
      Keith Daigle authored
      Summary:
      This breaks while building on aarch64 each time because the headers aren't
      in the repo. I did a quick grep and I don't see anything in folly that
      uses OptionalAwaitable or OptionalPromise so perhaps it's possible to
      remove instead, can do that if preferred.  Depends on D6611609 to complete
      build of tests cleanly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6643759
      
      fbshipit-source-id: f480d50383f85fbe905daaad74198b6557609347
      c60784b8
  8. 03 Jan, 2018 3 commits
    • Yedidya Feldblum's avatar
      Avoid allocs in dtors in futures collect · 92d510df
      Yedidya Feldblum authored
      Summary:
      [Folly] Avoid allocs in dtors in futures `collect`.
      
      `CollectContext`, a detail helper type, allocates storage for a results vector in its dtor. This is an awkward situation and should be avoided.
      
      Reviewed By: ericniebler
      
      Differential Revision: D6649299
      
      fbshipit-source-id: 87746fcc78fa080f63505d7bb864aca6c4a3d7cb
      92d510df
    • Keith Daigle's avatar
      Fix to build SharedMutexTest on aarch64 · eba5e7f2
      Keith Daigle authored
      Summary:
      While trying to build folly on aarch64 found that the SharedMutexTest
      wouldn't build because it uses RWTicketSpinLock which was only available
      on x86 platforms.  Updated to allow build on aarch64 after suggestion by Orvid
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6611609
      
      fbshipit-source-id: 8ec477cdedac0f0a705608bbac42dd63b3efb919
      eba5e7f2
    • Lee Howes's avatar
      Make consistent set of get and getTry methods on SemiFuture. · ff18deaf
      Lee Howes authored
      Summary: Complete set of get and getVia methods including addition of a result operation on FutureBase that provides functionality of the old getTry on Future by returning a Try by reference.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6640056
      
      fbshipit-source-id: 3ac01f7bc4b128e641f08d9a99280a18ffce82f9
      ff18deaf
  9. 02 Jan, 2018 5 commits
    • Yedidya Feldblum's avatar
      Remove SingletonVault C bindings · 661c75b6
      Yedidya Feldblum authored
      Summary: [Folly] Remove `SingletonVault` C bindings. They are not generally needed.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D6632104
      
      fbshipit-source-id: 3aecb35277bc76a2171487404d6994a5ea296afc
      661c75b6
    • Yedidya Feldblum's avatar
      Use member-invoke traits in LockTraits · 43523e0c
      Yedidya Feldblum authored
      Summary:
      [Folly] Use member-invoke traits in `LockTraits`.
      
      V.s. spelling out the SFINAE manually.
      
      Reviewed By: Orvid
      
      Differential Revision: D6637380
      
      fbshipit-source-id: 212e0cc5e54503b31e458b6bda93b2a3b24e6c59
      43523e0c
    • Yedidya Feldblum's avatar
      invoke and member-invoke tweaks · 1a50cb78
      Yedidya Feldblum authored
      Summary:
      [Folly] `invoke` and member-`invoke` tweaks.
      
      * Direct `static_cast` v.s. `std::forward` is okay.
      * Implement member-`invoke` in terms of `invoke` and extract most of it to a helper type, minimizing the code directly generated by the preprocessor.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D6644119
      
      fbshipit-source-id: e58a83d7ff2dd71b0377d864ef089c34e0239c8d
      1a50cb78
    • Yedidya Feldblum's avatar
      Add ColdClassTest.cpp to oss builds · 228c05ff
      Yedidya Feldblum authored
      Summary: [Folly] Add `ColdClassTest.cpp` to oss builds.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D6648831
      
      fbshipit-source-id: f8d8a727d63e4e8b83391db454de990027f1bad4
      228c05ff
    • Yedidya Feldblum's avatar
      Fix copyright lines for Bits.h and move BitsBenchmark.cpp · 337e3b8a
      Yedidya Feldblum authored
      Summary: [Folly] Fix copyright lines for `Bits.h` and move `BitsBenchmark.cpp`.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D6648828
      
      fbshipit-source-id: 5eed558ac2d47a1497d64173bc84a4ca27d79764
      337e3b8a
  10. 01 Jan, 2018 1 commit
    • Yedidya Feldblum's avatar
      Fix some copyright lines in folly/ · 454829ac
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix some copyright lines in `folly/`.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: Orvid
      
      Differential Revision: D6648215
      
      fbshipit-source-id: 6fc446028ff79aa44116424e86ad454077717f8e
      454829ac