1. 01 Feb, 2019 2 commits
  2. 31 Jan, 2019 2 commits
    • Lara Lu's avatar
      add copy constructor for KeepAlive · 291c761f
      Lara Lu authored
      Summary:
      There is a need for KeepAlive copy constructor from various users. Adding them after chatting with Andrii.
      Background: move is preferred to copy as the latter does an atomic counter increment. `copy()` was introduced but there is a need for more user-friendly way of copying.
      TODO: maybe get rid of `copy()` and its usages?
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13864057
      
      fbshipit-source-id: 38b2e45285566a3c2dba01706e82f421285b6bae
      291c761f
    • Caleb Marchent's avatar
      Include folly_pic in the opensource installed targets · ff841386
      Caleb Marchent authored
      Summary: Pull Request resolved: https://github.com/facebook/folly/pull/1006
      
      Reviewed By: Orvid
      
      Differential Revision: D13782299
      
      Pulled By: calebmarchent
      
      fbshipit-source-id: 7662c67a18c10a04d8d68e3f729da81c6df38336
      ff841386
  3. 30 Jan, 2019 3 commits
    • Shahzad Lone's avatar
      Reserve the vectors in ConcurrentHashMapTest (#998) · 6db47e87
      Shahzad Lone authored
      Summary:
      Even though this is a test, we are still reallocating a vector (resizing until re-sized/reallocated to 32), which in theory calls for allocation 5 times. But we can save this by just reserving the vector pre-hand (we know the size).
      Pull Request resolved: https://github.com/facebook/folly/pull/998
      
      Reviewed By: magedm
      
      Differential Revision: D13834292
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 6b0d16ef0200184d10ba292a0b1d8d3afdadf56d
      6db47e87
    • Alex Guzman's avatar
      Add some more OpenSSL 1.1.0 compat functions · 7ad42542
      Alex Guzman authored
      Summary: Adds functions for DH length to the compat library.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13584117
      
      fbshipit-source-id: ef753d58ee400fbaf8d47f59b7d39e17380ed417
      7ad42542
    • Yedidya Feldblum's avatar
      Apply clang-format to non-compliant locations (partial) · 1fd24252
      Yedidya Feldblum authored
      Summary:
      [Folly] Apply `clang-format` to non-compliant locations (partial).
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: igorsugak
      
      Differential Revision: D13858983
      
      fbshipit-source-id: 668c3ee209456befd3c03d85945321143da2b00a
      1fd24252
  4. 29 Jan, 2019 6 commits
    • Orvid King's avatar
      Remove uneeded boost/random includes · 1318513c
      Orvid King authored
      Summary: They aren't needed
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13855963
      
      fbshipit-source-id: c822a4b806350ef178906401b2239a865fd77119
      1318513c
    • Orvid King's avatar
      Fix Windows build · 99007fc3
      Orvid King authored
      Summary: It was broken due to oddities with how MSVC handles expanding `##__VA_ARGS__` within the parameters to macros. Rather than deal with the pre-processor, just return the check to how it was and use `EXPECT_TRUE(false)` to achieve the same effect.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13850142
      
      fbshipit-source-id: 887b39fb3c6072219c3f4748599bc7b707efbf25
      99007fc3
    • Yedidya Feldblum's avatar
      SemiFuture::deferError and Future::thenError taking tag · f44d1a08
      Yedidya Feldblum authored
      Summary: [Folly] SemiFuture::deferError and Future::thenError overloads taking exception-type-carrying tag to distinguish the exception type. Solves the case where `.deferError` or `.thenError` is called on an object with a dependent type, where passing the exception type otherwise requires the `template` keyword.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D13855497
      
      fbshipit-source-id: 74200853043e3fdbc08419b33b959f3519d704ef
      f44d1a08
    • Yedidya Feldblum's avatar
      A generic tag type · 515bf2bb
      Yedidya Feldblum authored
      Summary: [Folly] A generic tag type for all your generic tag-related needs. With naming following the pattern of `std::in_place_t` and `std::in_place`.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D13855499
      
      fbshipit-source-id: 50b7e41fbbb843c6c9b766f8b66484d6aa23c167
      515bf2bb
    • Giuseppe Ottaviano's avatar
      Replace value_before with std::prev · 91bc2fbe
      Giuseppe Ottaviano authored
      Summary:
      `value_before` looks like a pre-C++11 artifact, replace with `std::prev`.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13852269
      
      fbshipit-source-id: c2e4e8178754a694650f53633f099d05da4127d7
      91bc2fbe
    • Giuseppe Ottaviano's avatar
      Disable non-const access from upgrade locks · a238a687
      Giuseppe Ottaviano authored
      Summary:
      Upgrade locks allow access concurrently with readers, so mutating the state under an upgrade lock can potentially introduce a race unless proven otherwise.
      The main goal of this diff is to make the accessors to `Synchronized` state `const` under upgrade lock, as it happens under a shared lock. To achieve so, the diff changes the mechanism by which `const` is added: instead of unconditionally closing a `const Synchronized` in the `LockedPtr`, it captures the same constness as the `Synchronized`, and then the `const` decision is done at access time.
      
      This enables having an extra method `asNonConstUnsafe()` that gives non-const access when needed without requiring a `const_cast`. This is now provided for shared locks as well.
      
      Reviewed By: yfeldblum, aary, davidtgoldblatt
      
      Differential Revision: D13817413
      
      fbshipit-source-id: 8c315a925db9b1da8821984c59e55e90571b194e
      a238a687
  5. 28 Jan, 2019 2 commits
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/FBString.h · 5f535514
      Yedidya Feldblum authored
      Summary: [Folly] Apply `clang-format` to `folly/FBString.h`. A previous change was not properly formatted.
      
      Reviewed By: ot
      
      Differential Revision: D13831558
      
      fbshipit-source-id: 318404a3a14d6969cc2aa9601e72fae6ad6cfac2
      5f535514
    • Lee Howes's avatar
      Make onError depend on thenError · b29280e3
      Lee Howes authored
      Summary: Remove duplicate code from Future::onError and have it call Future::thenError.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13823960
      
      fbshipit-source-id: d2e48e4e65e30c80adbbd70ff314e1a418b7c1e2
      b29280e3
  6. 27 Jan, 2019 2 commits
    • Stepan Palamarchuk's avatar
      Add duration_cast when printing expected ms · 0e818b2e
      Stepan Palamarchuk authored
      Summary: As per Yedidya Feldblum comment on my previous diff, we need a duration cast in here.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13833032
      
      fbshipit-source-id: 8819694875bd3a7e4f54102d8ac77490f8287fbb
      0e818b2e
    • Lee Howes's avatar
      Remove thenError dependence on onError · 4fd1f3ad
      Lee Howes authored
      Summary:
      * Split thenError into future-returning and not-future-returning forms as we cannot rely on onError for this.
       * Move core functionality from onError into thenError to avoid thenError depending on onError.
       * Makes thenError's continuation consistent with other forms such that the parameter is passed by r-value, hence an l-value reference is no longer valid.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13820171
      
      fbshipit-source-id: cf42a7d1c0759c5cfbb03f8e66a6d6988f7e10c7
      4fd1f3ad
  7. 26 Jan, 2019 2 commits
    • Wez Furlong's avatar
      fbcode_builder: add VERBOSE=1 to make invocations · bf084642
      Wez Furlong authored
      Summary: This makes it easier to debug and diagnose build problems
      
      Reviewed By: simpkins
      
      Differential Revision: D13831342
      
      fbshipit-source-id: 3921a05715fb00264b2e1a6e134686d68aea804d
      bf084642
    • Yedidya Feldblum's avatar
      Cut various sites supporting MSVC <= 2015 · d129ad43
      Yedidya Feldblum authored
      Summary: [Folly] Cut various sites supporting MSVC <= 2015, which is insufficiently compatible.
      
      Reviewed By: Orvid
      
      Differential Revision: D13747631
      
      fbshipit-source-id: 3d63d3a57258b5695b1236a81f3ddfe2f4af9cb4
      d129ad43
  8. 25 Jan, 2019 6 commits
    • Jon Maltiel Swenson's avatar
      Don't hold GlobalCache mutex while scheduling OnDestruction callback · 4a0367d4
      Jon Maltiel Swenson authored
      Summary:
      Title. This gets rid of benign TSAN lock order inversion detections.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D13820662
      
      fbshipit-source-id: f092a988faa2cc897a1d046385e4bc4fd0422c7c
      4a0367d4
    • Dan Melnic's avatar
      Add an HHWheelTimer-fwd.h header · 3339cfbf
      Dan Melnic authored
      Summary: Add an HHWheelTimer-fwd.h header
      
      Reviewed By: djwatson
      
      Differential Revision: D13780411
      
      fbshipit-source-id: 795352c3eeed38cd52a270ebdf5dd734604415fa
      3339cfbf
    • Wez Furlong's avatar
      rsocket: add fbcode builder bits · 821d5083
      Wez Furlong authored
      Summary:
      This should allow more direct testing of changes without waiting for things to land on github first.
      
      As part of this, to avoid a conflict between the deps that bistro downloads and those used by
      the rest of the fbcode builder CI, I've updated the version of gtest used by bistro.
      
      Reviewed By: zertosh
      
      Differential Revision: D13802637
      
      fbshipit-source-id: fd71bfabd2a85f4f63c21b44a1e868f2d293180a
      821d5083
    • Andrii Grynenko's avatar
      Task::start with a callback · 648fd368
      Andrii Grynenko authored
      Summary: This is useful to avoid extra allocations when integrating with code that doesn't use folly::futures.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13812866
      
      fbshipit-source-id: aa76b8cda43d1a781e058f6edbe2ecb8100268de
      648fd368
    • Wez Furlong's avatar
      thrift: plumb rsocket into cmake build · 504981eb
      Wez Furlong authored
      Summary: The headers are installed, but we weren't compiling the implementation.
      
      Reviewed By: simpkins
      
      Differential Revision: D13778568
      
      fbshipit-source-id: 4d297b732d1e70bbd69100f13eb68f9477d7f014
      504981eb
    • Andrii Grynenko's avatar
      Improve FutureAwaitable::await_ready · 960770d1
      Andrii Grynenko authored
      Summary: This helps avoid executor re-schedule when Future is ready.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13805939
      
      fbshipit-source-id: f553c7a581882a7b53b004fd6bbb5087ea5787f8
      960770d1
  9. 24 Jan, 2019 9 commits
    • Jon Maltiel Swenson's avatar
      Make EventBase destruction callbacks safely cancellable · ffff09dd
      Jon Maltiel Swenson authored
      Summary: Currently, `runOnDestruction` aims to be thread-safe; new callbacks are added to the `onDestructionCallbacks_` list while the associated mutex is held. However, the caller may own the `LoopCallback` and wish to destroy/cancel it before the `EventBase` destructor runs, and this callback cancellation is not thread-safe, since unlinking does not happen under the lock protecting `onDestructionCallbacks_`. The primary motivation of this diff is to make on-destruction callback cancellation thread-safe; in particular, it is safe to cancel an on-destruction callback concurrently with `~EventBase()`.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D13440552
      
      fbshipit-source-id: 65cee1e361d37647920baaad4490dd26b791315d
      ffff09dd
    • Maged Michael's avatar
      hazptr: Apply timed reclamation to tagged and untagged lists · fd241ffa
      Maged Michael authored
      Summary: Apply timed reclamation to tagged and untagged lists to avoid accumulating a large amount of unreclaimed memory in use cases with large protectable structures.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D13779937
      
      fbshipit-source-id: e2e14ac5f18c1ee30808116cbc29d21895d9fb1c
      fd241ffa
    • Mingtao Yang's avatar
      Remove "movable buffers" codepath in AsyncSSLSocket · 1952cd00
      Mingtao Yang authored
      Reviewed By: yfeldblum
      
      Differential Revision: D13800383
      
      fbshipit-source-id: 61b988182cb8da6f084b62a0879f0ca917f8ad34
      1952cd00
    • Stepan Palamarchuk's avatar
      Avoid unnecessary looping over bitmap when scheduling new timeouts · 8b47e569
      Stepan Palamarchuk authored
      Summary:
      Current implementation will loop over bitmap to figure out next tick to schedule. This consumes visible amount of CPU (10% in fibers benchmark, ~4% of Thrift noop load test).
      
      However, this looping is unnecessary, because we already have all information available - what is the earliest pre-existing timeout (expireTick_) and the new one. So we can decide what tick to schedule for by just simple conditional statement.
      
      Reviewed By: vitaut
      
      Differential Revision: D13709523
      
      fbshipit-source-id: b0e3e6301cc2e759b4e8901ba5ff009587516cf5
      8b47e569
    • Michael Park's avatar
      Removed outdated comment. · 74ea5388
      Michael Park authored
      Summary: Got outdated in D3143931.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13494612
      
      fbshipit-source-id: e24bfea36896ec04b15fa443348e00f50f75940d
      74ea5388
    • Andrii Grynenko's avatar
      Fix FutureAwaitable to work with tail-call optimization · 446a5a23
      Andrii Grynenko authored
      Summary: setCallback_ is an internal API that doesn't provide a guarantee that when the callback is run the Try will be stored inside of the original future. Thus the Try should be moved by the callback instead.
      
      Reviewed By: LeeHowes
      
      Differential Revision: D13793991
      
      fbshipit-source-id: 1e8c4e423b8e1786099cae84bd99ac350c32d937
      446a5a23
    • Lara Lu's avatar
      executor with priority · e66fcd54
      Lara Lu authored
      Summary: make an adapter executor that forwards add to addWithPriority of the underlying executor
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13788642
      
      fbshipit-source-id: 5b4af43f4a3a3931817a2425890558f811152225
      e66fcd54
    • Yedidya Feldblum's avatar
      Cut pushmi example which uses non-yet-std names · 65e5d94a
      Yedidya Feldblum authored
      Summary: [Folly] Cut `pushmi` example which uses non-yet-`std` names.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D13777367
      
      fbshipit-source-id: 7ae846e74b622fb0f434220961d35bb243be6868
      65e5d94a
    • Stepan Palamarchuk's avatar
      Change T_CHECK_TIMEOUT and T_CHECK_TIME_LT to fail tests instead of skipping them · c612fab5
      Stepan Palamarchuk authored
      Summary:
      Most of the tests that use this macro, use it to ensure proper behavior of time-related logic (i.e. timeout didn't fire too early/late). Skipping them, simply masks a failure. The underlying utility already takes care of lags due to scheduling, so whenever this check fails - means we have a bug.
      
      In particular, we have 3 tests for HHWheelTimer that are always skipped, because their tolerance is below the expected lag of HHWheelTimer (it always rounds up, so we should expect +1ms always).
      
      Reviewed By: vitaut
      
      Differential Revision: D13746558
      
      fbshipit-source-id: 78f954f52414e640af92e5bb50790135cdd89a92
      c612fab5
  10. 23 Jan, 2019 2 commits
    • Lara Lu's avatar
      fix coro example in readme · 8f7f677d
      Lara Lu authored
      Summary: was reading coro example and i think a line is missing
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13788989
      
      fbshipit-source-id: ceb024a36ddd89369ee25f6632fce8d339c489cb
      8f7f677d
    • Yedidya Feldblum's avatar
      Tweak deletion of fbstring::operator= taking convertible-to char · 8946c3b5
      Yedidya Feldblum authored
      Summary: [Folly] Tweak deletion of `fbstring::operator=` taking convertible-to `char`.
      
      Reviewed By: Orvid
      
      Differential Revision: D13747744
      
      fbshipit-source-id: f254f13a15cb0e72120d1d02f4c8893a788e429a
      8946c3b5
  11. 22 Jan, 2019 4 commits
    • Adam Simpkins's avatar
      add a test case for SCOPE_FAIL with std::rethrow_exception() · 5f99ab65
      Adam Simpkins authored
      Summary:
      Make sure SCOPE_FAIL works with std::rethrow_exception().
      
      When compiled with older versions of gcc this code would fail due to a gcc
      bug: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62258
      The gcc bug was fixed in 4.9.4, 5.3, and the 6.0 branch.
      
      Reviewed By: meyering
      
      Differential Revision: D3280778
      
      fbshipit-source-id: 8fe1a9c1dc3ada61c8ebd7318538ae959b29a6b1
      5f99ab65
    • David Goldblatt's avatar
      ReadMostlyMainPtr: Add a stress test. · e9eae3ac
      David Goldblatt authored
      Summary:
      The other tests are either simple API tests for single-threaded cases, or a
      benchmark.
      
      Reviewed By: djwatson
      
      Differential Revision: D13678336
      
      fbshipit-source-id: 5aba91879d756097f42d245b5d318ad7c945dfeb
      e9eae3ac
    • Aaryaman Sagar's avatar
      Add unique_lock construction utility · fde4f26f
      Aaryaman Sagar authored
      Summary:
      Until C++17 constructor type deduction becomes a thing, we can use this
      instead to mimic unique_lock construction without having to specify the type
      of the mutex explicitly.
      
      ```
      auto lck = folly::make_unique_lock(mutex);
      
      // as opposed to
      
      auto lck = std::unique_lock<MutexType>{mutex};
      ```
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D10386999
      
      fbshipit-source-id: 0780a6d1769597a3888305248bcdf93a84c9f9ee
      fde4f26f
    • Xiao Shi's avatar
      document the non-standard compliance of `erase()` · d6ab7bcd
      Xiao Shi authored
      Summary: See F14.md changes.
      
      Reviewed By: nbronson
      
      Differential Revision: D13722323
      
      fbshipit-source-id: 70c68442cad56efc84bb29f0b694a7b71f837cbd
      d6ab7bcd