1. 17 Jan, 2018 11 commits
    • Adam Simpkins's avatar
      cmake: fix the test builds · e96129da
      Adam Simpkins authored
      Summary:
      - Fix the locations of some tests that have been moved.
      - Remove some tests that have been deleted.
      - Comment out some tests that depend on parts of folly that are not currently
        built by the CMake build scripts.
      - Fix a build error in CompressionTest.cpp if FOLLY_HAVE_LIBZ is not defined.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6735700
      
      fbshipit-source-id: 89f60751fa7079b2c609d23d85fbed2a0f317b55
      e96129da
    • Adam Simpkins's avatar
      fix a multiline comment warning · 6c511999
      Adam Simpkins authored
      Summary:
      DeterministicScheduleTest.cpp contained several single-line C++ comments that
      ended in a trailing backslash.  This makes the preprocessor treat the following
      line as a comment as well, even if it does not start with `//`.  Newer versions
      of gcc emit warnings about this.
      
      This changes the comment in DeterministicScheduleTest.cpp to use `/* */` to
      avoid this issue.
      
      Reviewed By: siyengar
      
      Differential Revision: D6735672
      
      fbshipit-source-id: 162c735507a643ce0dbee58f1f054865237e1eba
      6c511999
    • Adam Simpkins's avatar
      fix some bugs in AsyncSSLSocketTest · bdd9360c
      Adam Simpkins authored
      Summary:
      A couple of the test functions in AsyncSSLSocketTest maintained two EventBase
      objects and alternated looping between them.  In some cases it would call
      EventBase::loopOnce() even when there was no work to do.  This call normally
      blocks until an event is ready.  This happened to work when using libevent1,
      but this appears mostly accidental: with libevent1 EVLOOP_ONCE causes the loop
      to break out even after an "internal" I/O event; in libevent2 EVLOOP_ONCE only
      breaks out after a non-internal event has occurred:
      https://github.com/libevent/libevent/commit/0617a818204397790e5e4c9bcb9e91ae5ea7817a
      
      In these tests it turns out that the internal EventBase NotificationQueue
      always gets triggered the very first time loopOnce() is called, preventing
      these tests from hanging when using libevent1.
      
      This fixes the hang when using libevent2 by removing the initial loopOnce()
      calls that potentially have nothing to do.  This also consolidates the 2
      EventBase objects into one to avoid having to alternate loopOnce() calls
      between them without knowing which one actually has work to do.
      
      This also fixes an issue where the code never checked the return value of
      `recv()`
      
      Reviewed By: yfeldblum, siyengar
      
      Differential Revision: D6735669
      
      fbshipit-source-id: 5f36106a08866aa8908e82263f83a606399cdf79
      bdd9360c
    • Adam Simpkins's avatar
      suppress warnings in tests for deprecated functions · 7da4ef82
      Adam Simpkins authored
      Summary:
      Update ShellTest and PromiseTest to suppress warnings about using deprecated
      functions in the tests for those functions.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6735670
      
      fbshipit-source-id: 89edcb49d1eff3132398aaef88f5a5cae82e3557
      7da4ef82
    • Stepan Palamarchuk's avatar
      Add DCHECKs for checking that underlying IOBuf wasn't modified · 4bfbe0a1
      Stepan Palamarchuk authored
      Summary: Appending/prepending to IOBuf while iterating over it with Cursor is unsafe. This diff adds DCHECKs to catch such cases.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6735060
      
      fbshipit-source-id: 7799facc52c53fabd83756ecb26a18c4ebd69677
      4bfbe0a1
    • Dave Watson's avatar
      Loop Time · a4306bcd
      Dave Watson authored
      Summary:
      Only do the exponential loop smoothing once every 10ms.
      If we need it before then, do it linearly.
      
      Also, remove one of the now()s by only calling it once.
      
      Reviewed By: bmaurer, yfeldblum
      
      Differential Revision: D6690047
      
      fbshipit-source-id: 8267c01064aabc17cb8e86eb888e6120c99a129f
      a4306bcd
    • Stepan Palamarchuk's avatar
      Properly handle appending to the tail of the chain · 86cefd11
      Stepan Palamarchuk authored
      Summary: Currently appending to the tail of the chain would cause the cursor advancing to the beginning of the chain, which is not correct, instead we should advance to the tail.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6734999
      
      fbshipit-source-id: b8b2585e0475b656f7b6bf4ed39686e2ccb2e432
      86cefd11
    • Petr Lapukhov's avatar
      add tryCreateNetwork() · 9bf26065
      Petr Lapukhov authored
      Summary: Add non-throwing version of createNetwork(), and rework existing code to throw exceptions based on error codes returned by non-throwing version.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6705425
      
      fbshipit-source-id: 268ff64c36e7cceeea3463248d18b7b2cb81390e
      9bf26065
    • Yedidya Feldblum's avatar
      Fix Build: folly/synchronization/test/ParkingLotBenchmark.cpp (sign-compare, unused-variable) · 61cdb3dc
      Yedidya Feldblum authored
      Summary: [Folly] Fix Build: `folly/synchronization/test/ParkingLotBenchmark.cpp` (`sign-compare`, `unused-variable`).
      
      Reviewed By: djwatson
      
      Differential Revision: D6733586
      
      fbshipit-source-id: 04b82110e8e0b655e6b3994dbca3bd0b4bd57eef
      61cdb3dc
    • Adam Simpkins's avatar
      cmake: fix path to FindGLog.cmake · 19db503e
      Adam Simpkins authored
      Summary:
      The cmake files refer to this package as "FindGLog", but the file name on disk
      incorrectly had the 'L' lower cased.  This worked on case-insensitive file
      systems, but caused cmake to fail when used on a case-sensitive file system.
      
      This diff fixes the file name to match the name used in the cmake files.  This
      is also more consistent with the existing "FindGFlags" and "FindGMock"
      packages.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6710439
      
      fbshipit-source-id: 19f6824ef6793e505b5a0080c0fefe0b145a41c3
      19db503e
    • Yedidya Feldblum's avatar
      Revert D6725091: [Folly] Use thread-local in RequestContext::getStaticContext · cf930032
      Yedidya Feldblum authored
      Summary:
      This reverts commit 9979f39677284b1051cb109b461097495d77ca17
      
      bypass-lint
      
      An infra SEV is better than not reverting this diff.
      If you copy this password, see you in SEV Review!
      cause_a_sev_many_files
      
      Differential Revision: D6725091
      
      fbshipit-source-id: f1e3c80c869aa47684f5fbe79528e68174dee568
      cf930032
  2. 16 Jan, 2018 6 commits
    • Dave Watson's avatar
      parkinglot benchmark · 8893b8bc
      Dave Watson authored
      Summary: Add benchmark vs. futex
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6639280
      
      fbshipit-source-id: 9735444a7f48011f31603159561675d472cc4411
      8893b8bc
    • Jim Meyering's avatar
      define SKIP_IF · 492fad43
      Jim Meyering authored
      Summary:
      Finding ourselves writing too many identical "if (expr) SKIP << ..." statements,
      this change factors out/encapsulates the functionality.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6727531
      
      fbshipit-source-id: 703abcd5d8c30a6ebab94327a12da4f2d1f7ff74
      492fad43
    • Yedidya Feldblum's avatar
      Use thread-local in RequestContext::getStaticContext · 67462593
      Yedidya Feldblum authored
      Summary:
      [Folly] Use thread-local in `RequestContext::getStaticContext`.
      
      `folly::SingletonThreadLocal` uses `folly::ThreadLocal`. However, `static FOLLY_TLS` (`static __thread`) is always faster than `folly::ThreadLocal` for thread-local singletons for which iteration is not required.
      
      Reviewed By: djwatson
      
      Differential Revision: D6725091
      
      fbshipit-source-id: 9979f39677284b1051cb109b461097495d77ca17
      67462593
    • Yedidya Feldblum's avatar
      Fix missing WaitOptions symbol in autotools build · 1aabda15
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix missing `WaitOptions` symbol in autotools build.
      
      Closes #736.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D6724950
      
      fbshipit-source-id: 54ac0d1a743aa38fe1a7a2bdce585fced18c5a44
      1aabda15
    • Stepan Palamarchuk's avatar
      Track absolute position of the cursor · afde52ff
      Stepan Palamarchuk authored
      Summary:
      Start tracking the position of the cursor from the head of IOBuf chain. This comes at almost no cost (one arithmetic operation on IOBuf advance).
      
      The main use case for this cursor is Thrift deserialization code. It allows us to stop accumulating `xfer` on every single byte/field/element write and instead get it from Cursor in the end (when we're exiting Thrift code).
      This allows achieving ~10% better performance of deserialization.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6646813
      
      fbshipit-source-id: 8f796854a24a411698e96afe037695e816813022
      afde52ff
    • Stepan Palamarchuk's avatar
      Improve fast path of Cursor · 2c730d6f
      Stepan Palamarchuk authored
      Summary:
      This change simplifies the fastpath by reducing it to bare minimum (i.e. check length, load data) and removes indirection to IOBuf.
      Additionally it adds `skipNoAdvance` method to have 1-instruction skip.
      
      Disassembly of `read<signed char>` is over 35 instructions (just hot path). With this change it's doesn to 8.
      Disassembly after:
        Dump of assembler code for function folly::io::detail::CursorBase<folly::io::Cursor, folly::IOBuf const>::read<unsigned char>():
           0x000000000041f0f0 <+0>:     mov    0x18(%rdi),%rax
           0x000000000041f0f4 <+4>:     lea    0x1(%rax),%rcx
           0x000000000041f0f8 <+8>:     cmp    0x10(%rdi),%rcx
           0x000000000041f0fc <+12>:    ja     0x41f105 <folly::io::detail::CursorBase<folly::io::Cursor, folly::IOBuf const>::read<unsigned char>()+21>
           0x000000000041f0fe <+14>:    mov    (%rax),%al
           0x000000000041f100 <+16>:    mov    %rcx,0x18(%rdi)
           0x000000000041f104 <+20>:    retq
           0x000000000041f105 <+21>:    jmpq   0x41f110 <folly::io::detail::CursorBase<folly::io::Cursor, folly::IOBuf const>::readSlow<unsigned char>()>
      
      With this diff Thrift deserialization becomes ~20% faster (with prod workloads).
      
      Thrift benchmark:
      Before:
        ============================================================================
        thrift/lib/cpp2/test/ProtocolBench.cpp          relative  time/iter  iters/s
        ============================================================================
        BinaryProtocol_read_Empty                                   12.98ns   77.03M
        BinaryProtocol_read_SmallInt                                20.94ns   47.76M
        BinaryProtocol_read_BigInt                                  20.86ns   47.93M
        BinaryProtocol_read_SmallString                             34.64ns   28.86M
        BinaryProtocol_read_BigString                              185.53ns    5.39M
        BinaryProtocol_read_BigBinary                               67.34ns   14.85M
        BinaryProtocol_read_LargeBinary                             62.23ns   16.07M
        BinaryProtocol_read_Mixed                                   58.74ns   17.03M
        BinaryProtocol_read_SmallListInt                            89.99ns   11.11M
        BinaryProtocol_read_BigListInt                              39.92us   25.05K
        BinaryProtocol_read_BigListMixed                           616.20us    1.62K
        BinaryProtocol_read_LargeListMixed                          83.49ms    11.98
        CompactProtocol_read_Empty                                  11.28ns   88.67M
        CompactProtocol_read_SmallInt                               19.15ns   52.22M
        CompactProtocol_read_BigInt                                 26.14ns   38.25M
        CompactProtocol_read_SmallString                            31.04ns   32.22M
        CompactProtocol_read_BigString                             184.55ns    5.42M
        CompactProtocol_read_BigBinary                              69.73ns   14.34M
        CompactProtocol_read_LargeBinary                            64.39ns   15.53M
        CompactProtocol_read_Mixed                                  58.73ns   17.03M
        CompactProtocol_read_SmallListInt                           76.50ns   13.07M
        CompactProtocol_read_BigListInt                             25.93us   38.56K
        CompactProtocol_read_BigListMixed                          623.15us    1.60K
        CompactProtocol_read_LargeListMixed                         80.57ms    12.41
        ============================================================================
      
      After:
        ============================================================================
        thrift/lib/cpp2/test/ProtocolBench.cpp          relative  time/iter  iters/s
        ============================================================================
        BinaryProtocol_read_Empty                                   10.40ns   96.17M
        BinaryProtocol_read_SmallInt                                15.14ns   66.03M
        BinaryProtocol_read_BigInt                                  15.19ns   65.84M
        BinaryProtocol_read_SmallString                             25.19ns   39.70M
        BinaryProtocol_read_BigString                              172.85ns    5.79M
        BinaryProtocol_read_BigBinary                               56.88ns   17.58M
        BinaryProtocol_read_LargeBinary                             56.77ns   17.61M
        BinaryProtocol_read_Mixed                                   43.98ns   22.74M
        BinaryProtocol_read_SmallListInt                            58.19ns   17.19M
        BinaryProtocol_read_BigListInt                              19.75us   50.63K
        BinaryProtocol_read_BigListMixed                           440.20us    2.27K
        BinaryProtocol_read_LargeListMixed                          56.94ms    17.56
        CompactProtocol_read_Empty                                   9.35ns  106.93M
        CompactProtocol_read_SmallInt                               13.07ns   76.49M
        CompactProtocol_read_BigInt                                 18.23ns   54.87M
        CompactProtocol_read_SmallString                            25.61ns   39.05M
        CompactProtocol_read_BigString                             174.46ns    5.73M
        CompactProtocol_read_BigBinary                              59.77ns   16.73M
        CompactProtocol_read_LargeBinary                            60.81ns   16.44M
        CompactProtocol_read_Mixed                                  42.70ns   23.42M
        CompactProtocol_read_SmallListInt                           66.89ns   14.95M
        CompactProtocol_read_BigListInt                             25.08us   39.87K
        CompactProtocol_read_BigListMixed                          427.93us    2.34K
        CompactProtocol_read_LargeListMixed                         56.11ms    17.82
        ============================================================================
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6635325
      
      fbshipit-source-id: 393fc1005689042977c03f37f5a898ebe7814d44
      2c730d6f
  3. 15 Jan, 2018 1 commit
    • Alvaro Leiva Geisse's avatar
      allow command to accept "--" separator · d7b6ad49
      Alvaro Leiva Geisse authored
      Summary:
      Currently NestedCommandLineApp does not support `--` to indicate that the following arguments should be parsed as arguments, not nested commands or options.
      This diff fix that by whitelisting any argument given after "--"
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6721144
      
      fbshipit-source-id: 38a850b6ea803dc758c5fe65a21575e5faeac35b
      d7b6ad49
  4. 14 Jan, 2018 2 commits
    • Yedidya Feldblum's avatar
      Fix copyright lines · cd1bdc91
      Yedidya Feldblum authored
      Summary: [Folly] Fix copyright lines based on file histories.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D6720312
      
      fbshipit-source-id: c70a667a1977e70e2d4451ea624f96163982f681
      cd1bdc91
    • Yedidya Feldblum's avatar
      Convert newlines in folly/portability/PThread.cpp · e092e957
      Yedidya Feldblum authored
      Summary:
      [Folly] Convert newlines in `folly/portability/PThread.cpp`.
      
      ```
      dos2unix folly/portability/PThread.cpp
      ```
      
      Reviewed By: meyering
      
      Differential Revision: D6720343
      
      fbshipit-source-id: b92122b4a7012d7f8d73d293af51b4fcc868c582
      e092e957
  5. 13 Jan, 2018 6 commits
    • David Goldblatt's avatar
      Add Tearable, for concurrently-modified non-atomic objects. · 98d1077c
      David Goldblatt authored
      Summary:
      This adds the Tearable class template, which holds storage for an
      arbitrarily-sized object that can be concurrently read or written without any
      external synchronization.
      
      Reviewed By: yfeldblum, djwatson
      
      Differential Revision: D6422334
      
      fbshipit-source-id: ee3853bbd393ac8e30dca6439c61606cc5495f92
      98d1077c
    • Yedidya Feldblum's avatar
      Promote aligned_malloc and aligned_free · 47b2f8df
      Yedidya Feldblum authored
      Summary:
      [Folly] Promote `aligned_malloc` and `aligned_free` from `namespace folly::detail` to `namespace folly`.
      
      And move them from `folly/portability/Memory.h` to `folly/Memory.h`.
      
      Differential Revision: D6153394
      
      fbshipit-source-id: eef314d2bc171910ea3c8403da9e9e1d1858ce15
      47b2f8df
    • Adam Simpkins's avatar
      cmake: remove DOS-style line endings · 337e897a
      Adam Simpkins authored
      Summary:
      A number of the files in CMake/ had inconsistent line-endings.  This updates
      files using DOS-style CRLF line endings to just use CR instead.  On Windows,
      git is capable of automatically changing CR to CRLF when checking out the
      repository working directory.
      
      Reviewed By: meyering
      
      Differential Revision: D6714717
      
      fbshipit-source-id: 82adccf4e522d38fd1cb420869f62e52dbd6c5f1
      337e897a
    • Adam Simpkins's avatar
      cmake: add checks to generate folly-config.h correctly · b22d1721
      Adam Simpkins authored
      Summary:
      Add proper checks to detect and set the values in folly-config.h correctly.
      Previously the code simply hard-coded values that were appropriate for Windows.
      
      This does not yet define all of the settings produced by the autoconf build,
      but it lets the CMake-based build largely succeed on Linux systems.
      
      Reviewed By: meyering
      
      Differential Revision: D6710437
      
      fbshipit-source-id: 80490080ee6322995b740ac2a15181d220c6874a
      b22d1721
    • Adam Simpkins's avatar
      cmake: set compiler flags for non-Windows platforms · 03957924
      Adam Simpkins authored
      Summary:
      Update CMakeLists.txt to check the current platform, and to set compiler flags
      correctly.  It now uses flags for Microsoft Visual Studio on Windows, and flags
      for gcc or clang on all other platforms.  Previously it unconditionally used
      MSVC flags.
      
      Reviewed By: meyering
      
      Differential Revision: D6710435
      
      fbshipit-source-id: dbae3097bcadf1ee4a25879dd7770603387c0e4d
      03957924
    • Adam Simpkins's avatar
      cmake: support using a separate build directory · 3d9eb7ff
      Adam Simpkins authored
      Summary:
      Fix rules in the CMakeLists.txt file that generate source files to first create
      their output directory if necessary.  This allows the build to succeed when
      building with a separate build output directory, rather than placing build
      artifacts in the source tree itself.
      
      Reviewed By: meyering
      
      Differential Revision: D6710436
      
      fbshipit-source-id: 786a65a37a70833e7e4a5affe4df292626dbb591
      3d9eb7ff
  6. 12 Jan, 2018 5 commits
    • Eric Niebler's avatar
      correctly handle APIs that accept Poly<T&> as an argument · 4a5ba093
      Eric Niebler authored
      Summary: Multi-dispatch in Poly was handled by treating arguments of type Poly<I&> as special, unwrapping them. That's a problem if the underlying API actually wants the Poly<I&> unmolested.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6713975
      
      fbshipit-source-id: 18a90fa701fab14c3d3d46c247efe09ea5903b11
      4a5ba093
    • Sergey Makarenko's avatar
      Register singleton's destruction using std::atexit · 3f4a8ae0
      Sergey Makarenko authored
      Summary:
      scheduleDestroyInstances function is called from createInstance function when
      new instance of specific singleton type is created thus marking a point in
      static objects order  when all singltons will be destructed.
      This does not work well for situations when singleton is loaded as part of
      python extension which is a shared object. In this case static objects of this
      shared object would be constructed first and singleton from this extension will
      be created after that. Since destruction order is reversed and all singletons
      will be destructed together, static objects of python extension will be
      destroyed before singleton from this extension. Which leads to heap-after-free
      ASAN exceptions.
      In other words, lifetime of all folly singletons is aligned to the lifetime of the
      first created folly singleton.
      Using std::atexit to register singleton's destruction from singleton
      constructor will align  lifetime of singletons to the most recent singleton
      which matters for python extensions and does not matter for other use cases.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D6705644
      
      fbshipit-source-id: 5c933886ceae649e3c75f8e7e7936d5a7ed04539
      3f4a8ae0
    • Enji Cooper's avatar
      Spell uintptr_t properly in static_assert in `getStackTrace()` · c7801abd
      Enji Cooper authored
      Summary:
      While here, pet the linter with respect to the warning around the indentation with the comment containing the licensing tort.
      Signed-off-by: default avatarEnji Cooper <yaneurabeya@gmail.com>
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6710314
      
      fbshipit-source-id: fc0b971e6300af9c63a690c54c08fc70e0313b70
      c7801abd
    • Yedidya Feldblum's avatar
      Unsafe pre-sorted construction for sorted-vector containers · fd5eeb5f
      Yedidya Feldblum authored
      Summary:
      [Folly] Unsafe pre-sorted construction for sorted-vector containers.
      
      If the backing container type can be constructed directly in sorted order or can be determined in advance to be in sorted order, then a special constructor can help code take advantage of this condition by avoiding an extra invocation of `std::sort`.
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D6708379
      
      fbshipit-source-id: 25d886b0814dc9230c6046ed1e7f199fac47754e
      fd5eeb5f
    • Adam Simpkins's avatar
      cmake: fix error message on non-Windows platform · ab21322d
      Adam Simpkins authored
      Summary:
      Building folly with cmake is only supported on Windows for now.  This fixes
      cmake on non-Windows platforms to fail with a helpful message telling people to
      use autoconf.  This message was in place before, but was after an MSVC version
      check preventing it from appearing.
      
      Reviewed By: meyering
      
      Differential Revision: D6707328
      
      fbshipit-source-id: a28a07ab0da41d605b11d93bba40f33520c5f57e
      ab21322d
  7. 11 Jan, 2018 5 commits
    • Yedidya Feldblum's avatar
      MemoryIdler::futexWaitUntil · b1fe65ff
      Yedidya Feldblum authored
      Summary:
      [Folly] `MemoryIdler::futexWaitUntil`.
      
      Adds `MemoryIdler::futexWaitUntil` that works like `Futex::futexWaitUntil`, in a similar way that `MemoryIdler::futexWait` works like `Futex::futexWait`.
      
      Removes the ability to customize the idle-timeout clock for `MemoryIdler::futexWait` as a side-effect; the idle-timeout is now a pure duration. Now, the clock used with the idle-timeout is the same as the normal deadline clock, so the idle-timeout clock can be set for `MemoryIdler::futexWaitUntil` by providing a deadline with that clock type. This normally would not matter, but it affects the unit-tests.
      
      Reviewed By: djwatson
      
      Differential Revision: D6681679
      
      fbshipit-source-id: e3cf6e71d7530c5877a834b318b423eb91f71eb9
      b1fe65ff
    • Dave Watson's avatar
      Relax stop_ memory order · 3d2b926a
      Dave Watson authored
      Summary: stop_ can be relaxed everywhere, it implies only an asynchronous signal, not any sort of memory barrier.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D6690079
      
      fbshipit-source-id: 6f193204e1619f9a8adf81db2d46d05954bfbf85
      3d2b926a
    • Yedidya Feldblum's avatar
      Cut the ScopeGuard alias now that we have auto · 653053aa
      Yedidya Feldblum authored
      Summary:
      [Folly] Cut the `ScopeGuard` alias now that we have `auto`.
      
      This form works because of hidden lifetime extension:
      ```lang=c++
      folly::ScopeGuard guard = folly::makeGuard([] { /*...*/ });
      //  ...
      //  guard falls out of scope
      ```
      But this form would not work correctly:
      ```lang=c++
      folly::ScopeGuard guard = folly::makeGuard([] { /*...*/ });
      std::async(std::launch::async, [guard = std::move(guard)] {});
      ```
      Because `folly::ScopeGuard` is an rvalue-reference-to-base.
      We have `auto`, so just remove `folly::ScopeGuard`. This form works correctly:
      ```lang=c++
      auto guard = folly::makeGuard([] { /*...*/ });
      std::async(std::launch::async, [guard = std::move(guard)] {});
      ```
      
      Reviewed By: igorsugak
      
      Differential Revision: D6690070
      
      fbshipit-source-id: 54e32b300d36fce4eb95a59f1828819afe312ec0
      653053aa
    • Yedidya Feldblum's avatar
      Move ScopeGuardImpl and ScopeGuardImplBase into the detail namespace · e61c2150
      Yedidya Feldblum authored
      Summary:
      [Folly] Move `ScopeGuardImpl` and `ScopeGuardImplBase` into the `detail` namespace.
      
      Let them be marked as private implementation details.
      
      Reviewed By: andrewjcg
      
      Differential Revision: D6665317
      
      fbshipit-source-id: 03e8fee6a16338395ec92c582613b053bd9f74ec
      e61c2150
    • Yedidya Feldblum's avatar
      Stop using ScopeGuardImpl in DynamicParser · 5277a636
      Yedidya Feldblum authored
      Summary:
      [Folly] Stop using `ScopeGuardImpl` in `DynamicParser`.
      
      `ScopeGuardImpl` is an impl type that should not be treated as public.
      
      Reviewed By: igorsugak
      
      Differential Revision: D6689835
      
      fbshipit-source-id: aea6c985e40887594c0aeb0c0948fa77c149a89b
      5277a636
  8. 10 Jan, 2018 4 commits
    • Yedidya Feldblum's avatar
      folly::Init, RAII variant of folly::init · 7bf14860
      Yedidya Feldblum authored
      Summary:
      [Folly] `folly::Init`, RAII variant of `folly::init`.
      
      Use it in `main` used by unit-tests.
      
      Reviewed By: ot
      
      Differential Revision: D6566358
      
      fbshipit-source-id: fb8e5a18fc43eb65e2cbeb070d97094bd413bb96
      7bf14860
    • Maged Michael's avatar
      UnboundedQueue: Use hazptr_obj_batch · 2d80d4e0
      Maged Michael authored
      Summary: Manage retirement of removed segments using hazptr_obj_batch in order to reduce the chances of fragmenting related segments across thread local lists of retired objects of many threads, which could lead to unnecessarily high memory usage.
      
      Reviewed By: djwatson
      
      Differential Revision: D6686697
      
      fbshipit-source-id: 0d786c0f9e0bac2c44183ed3da21619e1feb3d52
      2d80d4e0
    • Adam Simpkins's avatar
      logging: fix build error when using gcc with -Wmissing-braces · 79a92dfd
      Adam Simpkins authored
      Summary:
      Since std::array is actually a struct containing an array it technically
      requires double braces around its initializer.  The language allows eliding
      these braces, and clang doesn't complain about only using a single brace, but
      gcc does when using `-Wmissing-braces`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D6695289
      
      fbshipit-source-id: 913fcfbea4164a02d001bd2344e340c0b6ee62aa
      79a92dfd
    • Yedidya Feldblum's avatar
      Let Futex import base-class ctors · dcf8a19c
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `Futex` import base-class ctors.
      
      Rather than needing to define ctors and inherit `boost::noncopyable`.
      
      Reviewed By: WillerZ
      
      Differential Revision: D6674054
      
      fbshipit-source-id: 59e0a4815682b227346954fe47c6eda49e3ad62f
      dcf8a19c