1. 31 Dec, 2017 1 commit
    • Yedidya Feldblum's avatar
      Give detail functions in ConstexprMath.h decorated names · 4753aa16
      Yedidya Feldblum authored
      Summary:
      [Folly] Give detail functions in `ConstexprMath.h` decorated names.
      
      So that other code also in `namespace folly::detail` which invokes the non-detail functions will result in ambiguity.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D6646313
      
      fbshipit-source-id: 679e4cfe1c90f494acacef8b2a38a453db4d79d5
      4753aa16
  2. 30 Dec, 2017 3 commits
  3. 28 Dec, 2017 3 commits
    • Aaryaman Sagar's avatar
      Added remove_cvref · e14ef532
      Aaryaman Sagar authored
      Summary:
      std::remove_cvref is like std::decay, but without the function to
      pointer and array to pointer decays
      
      Backport of http://en.cppreference.com/w/cpp/types/remove_cvref
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6639513
      
      fbshipit-source-id: 2a5e252678aacc09acf6ce4565872e7efb9b48f3
      e14ef532
    • Aaryaman Sagar's avatar
      folly::Indestructible interface improvement · 3c127a77
      Aaryaman Sagar authored
      Summary:
      As it stands the user cannot use initializer list constructors in the
      underlying type, this fixes that and provides a good interface change.
      This allows them to use list initialization, which works with initializer
      lists
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6620994
      
      fbshipit-source-id: c29199f97b434d84dd8d4cee2f00c5eccb316166
      3c127a77
    • Dave Watson's avatar
      synchronization/ParkingLot · 84ad2a4d
      Dave Watson authored
      Summary:
      A ParkingLot API inspired by linux futex syscall, and WebKit's parkingLot.
      
      Extends the futex interface with lambdas, such that many different sleeping abstractions
      can be built.
      
      Reviewed By: yfeldblum, aary
      
      Differential Revision: D6581826
      
      fbshipit-source-id: dba741fe4ed34f27bfad5f5747adce85741441e0
      84ad2a4d
  4. 27 Dec, 2017 6 commits
    • Lee Howes's avatar
      Add getVia and getTryVia to SemiFuture. · cadfe2cd
      Lee Howes authored
      Summary: Add getVia and getTryVia to SemiFuture to allow driving chains of work conveniently in the current thread.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6631898
      
      fbshipit-source-id: 324ef342a44d4ef502188b3cffde17103f0e6cb2
      cadfe2cd
    • Lee Howes's avatar
      Move getTry to subclasses. · 5b640629
      Lee Howes authored
      Summary:
      Move getTry from FutureBase to Future and SemiFuture.
      
      Make SemiFuture version move the result out for consistency with get.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6638561
      
      fbshipit-source-id: 551c0f06ed52ef6d8976a5971a5e90b3ab793da0
      5b640629
    • Lee Howes's avatar
      Add continuation to semifuture return test. · d0da61c2
      Lee Howes authored
      Summary: Add more detail to testing return of SemiFuture from a continuation to ensure correct behaviour.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6637565
      
      fbshipit-source-id: 096a7ca140e6bdef7baab6725e86d25cf79742d8
      d0da61c2
    • Lee Howes's avatar
      Add deprecation comments to folly::makeFuture. · 7acba7e1
      Lee Howes authored
      Summary:
      To ensure that we do not end up with continuable futures without attached executors we should deprecate folly::makeFuture. In most cases folly::makeSemiFuture is adequate here.
      
      This diff only adds comments to dissuade future use.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6628800
      
      fbshipit-source-id: c2b91df351cc5980c1bfb752f7536d320ef8168a
      7acba7e1
    • Lee Howes's avatar
      Add getSemiFuture to folly::SharedPromise · a5b53283
      Lee Howes authored
      Summary: Adds getSemiFuture functionality to folly::SharedPromise. Implements getFuture in terms of this, using folly::InlineExecutor to ensure that there is no change of behaviour.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6628723
      
      fbshipit-source-id: 0ce7c7773b9290998ce87f84fa5d82ba957f0313
      a5b53283
    • Yedidya Feldblum's avatar
      Namespacing and comments in folly/Likely.h · db0ea224
      Yedidya Feldblum authored
      Summary:
      [Folly] Namespacing and comments in `folly/Likely.h`.
      
      This adds `FOLLY_LIKELY` and `FOLLY_UNLIKELY`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6636136
      
      fbshipit-source-id: da93220201cabca91b4477ab98269a0febb735db
      db0ea224
  5. 26 Dec, 2017 8 commits
    • Yedidya Feldblum's avatar
      Tweaks to AtomicStruct · af28f118
      Yedidya Feldblum authored
      Summary: [Folly] Tweaks to `AtomicStruct`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6636432
      
      fbshipit-source-id: 274c118a732287219c569d7d3f4e170f275518f1
      af28f118
    • Lee Howes's avatar
      Ensure that returning a semifuture from a continuation works correctly. · fb2a27a3
      Lee Howes authored
      Summary: Returning a SemiFuture from a continuation should work by correctly checking the types and returning a folly::Future on the same executor as the original future that .then was applied to.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6597273
      
      fbshipit-source-id: cf2016a344d4b29f1d31c1da20c89df5b4cfe64e
      fb2a27a3
    • Yedidya Feldblum's avatar
      Remove folly/detail/UncaughtExceptionCounter.h · d0956208
      Yedidya Feldblum authored
      Summary:
      [Folly] Remove `folly/detail/UncaughtExceptionCounter.h`.
      
      It's a thin and unnecessary shell around `folly/UncaughtExceptions.h`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6636260
      
      fbshipit-source-id: cdf6fa5fefc9fd69586c1c4c1a8443c5e8543b1c
      d0956208
    • Yedidya Feldblum's avatar
      constexpr_log2_ceil · 3b8919b3
      Yedidya Feldblum authored
      Summary: [Folly] `constexpr_log2_ceil`, like `constexpr_log2` but rounding up.
      
      Reviewed By: Orvid
      
      Differential Revision: D6636433
      
      fbshipit-source-id: a10f031cc9c91cfeba7b74bbf143895a311ca772
      3b8919b3
    • Yedidya Feldblum's avatar
      Move folly/detail/Sleeper.h to folly/synchronization/detail/ · e50d7df4
      Yedidya Feldblum authored
      Summary: [Folly] Move `folly/detail/Sleeper.h` to `folly/synchronization/detail/`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6636459
      
      fbshipit-source-id: e0b37459fe721c96837b653e652c1bc6bfeb5dce
      e50d7df4
    • Gabriel Wicke's avatar
      Fix link to window tests in folly/future/README.md · 9fbe3ea2
      Gabriel Wicke authored
      Summary:
      Window tests were moved to a separate file. Update the README to the
      new location.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6636178
      
      fbshipit-source-id: 0313dfe80de7686e1e530ed9eb4bbcefb459633c
      9fbe3ea2
    • Yedidya Feldblum's avatar
      Format digits10 · 3764ca2b
      Yedidya Feldblum authored
      Summary: [Folly] Format `digits10`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6636190
      
      fbshipit-source-id: 6e6b834f6c9070d58f8e2b085b09df8b857fe878
      3764ca2b
    • Yedidya Feldblum's avatar
      Move folly/AtomicStruct.h to folly/synchronization/ · 078d29f7
      Yedidya Feldblum authored
      Summary: [Folly] Move `folly/AtomicStruct.h` to `folly/synchronization/`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6636072
      
      fbshipit-source-id: 87098e25fc40d0d60b4a657ba395418388e170fc
      078d29f7
  6. 25 Dec, 2017 1 commit
    • Yedidya Feldblum's avatar
      Remove unused boost dep from Conv.h · c2d5c904
      Yedidya Feldblum authored
      Summary: [Folly] Remove unused `boost` dep from `Conv.h`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6636040
      
      fbshipit-source-id: 77dbfcf95f68c05346bce52d1a965e465c2efe3b
      c2d5c904
  7. 24 Dec, 2017 1 commit
    • Yedidya Feldblum's avatar
      Update homebrew script to use gtest 1.8.0 · 963dc51a
      Yedidya Feldblum authored
      Summary:
      [Folly] Update homebrew script to use gtest 1.8.0, to be consistent with the docs.
      
      Closes #722.
      
      Reviewed By: Orvid
      
      Differential Revision: D6633606
      
      fbshipit-source-id: 5e9a5790100fe7a408be7a9a77c847bece91d405
      963dc51a
  8. 23 Dec, 2017 3 commits
    • Yedidya Feldblum's avatar
      Move expensive Singleton code to .cpp · 9fef1cd9
      Yedidya Feldblum authored
      Summary:
      [Folly] Move expensive `Singleton` code to `.cpp`.
      
      Including string manipulation, `ostream::operator<<` operations, `throw` statements, etc,
      
      Reviewed By: ot
      
      Differential Revision: D6632052
      
      fbshipit-source-id: 82e0033d5042b02951cf3b05c55cf62c97cc2b6d
      9fef1cd9
    • Lee Howes's avatar
      Add getSemiFuture to folly::Promise · 48b9743d
      Lee Howes authored
      Summary: Also deprecates folly::getFuture function.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6594299
      
      fbshipit-source-id: 67435f35dca660da049cd8c505ee9a21424c0d2b
      48b9743d
    • Yedidya Feldblum's avatar
      Namespace portability symbols better in Singleton.cpp · e951fd70
      Yedidya Feldblum authored
      Summary: [Folly] Namespace portability symbols better in `Singleton.cpp`.
      
      Reviewed By: Orvid
      
      Differential Revision: D6631290
      
      fbshipit-source-id: eb802ace6a9bf704e011eb44710922c997a9cd8e
      e951fd70
  9. 22 Dec, 2017 2 commits
  10. 21 Dec, 2017 1 commit
    • Andrii Nakryiko's avatar
      Fix crashing on corrupted ELF binaries with invalid offsets in ELF header. · 5d64a503
      Andrii Nakryiko authored
      Summary:
      There are cases where ELF binaries are running fine, but have slightly
      corrupted ELF headers, e.g., with section headers offset pointing beyond boundaries
      of file. I'm guessing this is due to running strip or objdump with either some
      particular combination of flags or some due to buggy version of those tools. This
      change prevents from crashing on such files.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6616027
      
      fbshipit-source-id: 8cb3ac4475a51d1f1045c395977a6a77fbefffb2
      5d64a503
  11. 20 Dec, 2017 6 commits
    • Chad Austin's avatar
      test that the value remains alive even if the .then callback takes no arguments · 9df5dacf
      Chad Austin authored
      Summary:
      It was not clear to me, if a callback takes no arguments, the
      underlying value is guaranteed to be alive during the execution of the
      callback, so I wrote these tests.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6594921
      
      fbshipit-source-id: 6a658afc1bf4d29eaa9c62269ddc21c7f897ad01
      9df5dacf
    • Yedidya Feldblum's avatar
      Kill FOLLY_ALIGNED etc · 8091d719
      Yedidya Feldblum authored
      Summary:
      [Folly] Kill `FOLLY_ALIGNED` etc.
      
      `alignas` is standardized as of C++11. Let us just use that.
      
      Replace:
      * `FOLLY_ALIGNED` with `alignas`
      * `FOLLY_ALIGNED_MAX` with `alignas(folly::max_align_v)`
      * `FOLLY_ALIGN_TO_AVOID_FALSE_SHARING` with `alignas(folly::hardware_destructive_interference_size)`
      
      Because where `alignas` may be placed is more restrictive than where attributes may be placed, we also need to move these directives in some cases on top of doing the replacement.
      
      Reviewed By: Orvid
      
      Differential Revision: D6555167
      
      fbshipit-source-id: 4b05b570bace3f8c0fe810b6dd58781dd45757f4
      8091d719
    • Yedidya Feldblum's avatar
      Fix Build: propagate_const under GCC · 1166fe0e
      Yedidya Feldblum authored
      Summary: [Folly] Fix Build: `propagate_const` under GCC.
      
      Reviewed By: aary
      
      Differential Revision: D6609722
      
      fbshipit-source-id: 47d8b0f2d54e0e5834383ea64c93af30927c921d
      1166fe0e
    • Zheng Yan's avatar
      Add readWithPriority to PriorityMPMCQueue · 67300dac
      Zheng Yan authored
      Summary: Add readWithPriority to PriorityMPMCQueue
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6606604
      
      fbshipit-source-id: 07382e3c6d0f53a8727c059410c0577cf0aac82c
      67300dac
    • Yedidya Feldblum's avatar
      Add hardware_destructive_interference_size · 5ad17f07
      Yedidya Feldblum authored
      Summary:
      [Folly] Add `hardware_destructive_interference_size` and `hardware_constructive_interference_size` to `folly/lang/Align.h`.
      
      As backports from C++17. Which may require keeping, depending on how stanard libraries choose to implement these.
      
      And replace `CacheLocality::kFalseSharingRange` with `hardware_destructive_interference_size`.
      
      Reviewed By: ot
      
      Differential Revision: D6554817
      
      fbshipit-source-id: bff49f5ca8b01d38fa806076f99201355df76cd9
      5ad17f07
    • Yedidya Feldblum's avatar
      propagate_const · d1ef992f
      Yedidya Feldblum authored
      Summary: [Folly] `propagate_const`, backported from C++ Library Fundamentals TS v2.
      
      Reviewed By: ericniebler
      
      Differential Revision: D6589681
      
      fbshipit-source-id: cdc8981d17938b99afe60e2baefff7deb5316612
      d1ef992f
  12. 19 Dec, 2017 5 commits
    • Dave Watson's avatar
      Fix erase in Iterate (2) · a807bde9
      Dave Watson authored
      Summary:
      Previously D6579707.
      
      Correctly advance to next item if we erase the current element.  Corner cases were slightly off if we were at the end of a hash chain.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6603518
      
      fbshipit-source-id: acb959e5bcd5da1c3df642b75985d464fdd3b23d
      a807bde9
    • Dave Watson's avatar
      Fix ThreadLocal races · 74502e3c
      Dave Watson authored
      Summary:
      I misread the ThreadLocal docs, thread destruction functions do *not* grab the accessAllTHreads_ lock
      unless you use *strict* mode, and even then, it is only a read lock.
      
      Easy enough to make the thread-destruction global bits to be atomic / use folly::Synchronized.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6592905
      
      fbshipit-source-id: 4ae600dff4c8c04751483a452ca7c07ef3f26380
      74502e3c
    • Yedidya Feldblum's avatar
      Switch the Baton template params · 58399f25
      Yedidya Feldblum authored
      Summary: [Folly] Switch the `Baton` template params for consistency with `SaturatingSemaphore`.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D6591060
      
      fbshipit-source-id: 44d6243d3185d95364a27e497216cc02fb3bc2e8
      58399f25
    • Dustin Pho's avatar
      Secure RNG utilities · a72e7903
      Dustin Pho authored
      Summary: Adding secure RNG utility functions (rand32, rand64, oneIn, randDouble01, randDouble).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6551975
      
      fbshipit-source-id: 720d138de1329669b1a15eb3e9cb3fe91ce982a4
      a72e7903
    • Yedidya Feldblum's avatar
      Baton::ready, a const variant of try_wait · 7fc3f917
      Yedidya Feldblum authored
      Summary: [Folly] `Baton::ready`, a `const` variant of `try_wait`.
      
      Reviewed By: djwatson
      
      Differential Revision: D6508064
      
      fbshipit-source-id: ba458577574ba58165408a93238da7eb09adf1e6
      7fc3f917