1. 08 Jan, 2017 2 commits
    • Igor Sugak's avatar
      remove always true if-predicate (gcc-5 -Wlogical-op) · 7895dc70
      Igor Sugak authored
      Summary:
      gcc-5 -Wlogical-op reports:
      ```lang=bash
      folly/io/async/AsyncSSLSocket.cpp: In member function 'void folly::AsyncSSLSocket::invalidState(folly::AsyncSSLSocket::HandshakeCB*)':
      folly/io/async/AsyncSSLSocket.cpp:418:35: error: logical 'or' of collectively exhaustive tests is always true [-Werror=logical-op]
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4391317
      
      fbshipit-source-id: c0f5ce748f1fc21678e4080c7f6351e7fada1e2b
      7895dc70
    • Eric Niebler's avatar
      add folly::as_const, like C++17's std::as_const · 3cec19d4
      Eric Niebler authored
      Summary: A one-liner from C++17, but a useful one. Const-qualifies an lvalue reference, avoiding the need for an awkward const_cast in some cases.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4389929
      
      fbshipit-source-id: 1650c4901489eb0dd62fd9fa633b4a0da9f01954
      3cec19d4
  2. 07 Jan, 2017 6 commits
    • Christopher Dykes's avatar
      Properly std::chrono'ize HHWheelTimer · 3cdd3857
      Christopher Dykes authored
      Summary: It was using `std::chrono::milliseconds` to represent a point in time, so use a time point instead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4378116
      
      fbshipit-source-id: f0b10bb7894dda44d78b31672d2b6735f3e1cbf4
      3cdd3857
    • Christopher Dykes's avatar
      std::chrono'ize EventBase::loopBody · 77249d4d
      Christopher Dykes authored
      Summary: Because modern is good, and this allows for cleaner interaction with the other APIs being `std::chrono`ized.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4377773
      
      fbshipit-source-id: 42ad5ad8476a3678e02e9314f9592f5449102f00
      77249d4d
    • Christopher Dykes's avatar
      std::chrono'ize EventBase::setMaxLatency · aee08623
      Christopher Dykes authored
      Summary: Onward towards more modern code!
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4377678
      
      fbshipit-source-id: 6ca5ecd902be9028fb55f139374f7919fa522899
      aee08623
    • Yedidya Feldblum's avatar
      Remove <glog/logging.h> from folly/Indestructible.h · 8f22c4e3
      Yedidya Feldblum authored
      Summary:
      [Folly] Remove `<glog/logging.h>` from `folly/Indestructible.h`.
      
      This makes the header much lighter. And abort on invalid access (the use-case for `glog`) only in `!defined(NDEBUG)` mode.
      
      Anti-Pattern Combined Mega-Diff Description:
      * Add non-`explicit` default ctor.
      * Disable ctor explicitly when underlying ctor would fail to compile. Not sure how useful it would be, but it makes type-traits work correctly for whatever that is worth.
      * Switch boolean flag to `erased_{false}` so that it is zero-initializable, because that's better.
      
      Reviewed By: ericniebler
      
      Differential Revision: D4380469
      
      fbshipit-source-id: a39cb7470f7ee678fa722778da587409f468d985
      8f22c4e3
    • Eric Niebler's avatar
      add folly::void_t like C++17's std::void_t · e3974815
      Eric Niebler authored
      Summary:
      C++17 is adding std::void_t. It's handy for controlling class template partial specialization. Folly should have it too.
      
      See http://en.cppreference.com/w/cpp/types/void_t
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4387302
      
      fbshipit-source-id: 85f955f3d8cfacbd6c9e61fb3f5cf53c056459bb
      e3974815
    • Yedidya Feldblum's avatar
      Skip defined checks in folly/Memory.h · c5e6d87b
      Yedidya Feldblum authored
      Summary:
      [Folly] Skip `defined` checks in `folly/Memory.h`.
      
      Undefined symbols, when evaluated by the preprocessor in preprocessor integer contexts, evaluate to `0`. That works for these checks.
      
      Reviewed By: ericniebler
      
      Differential Revision: D4385026
      
      fbshipit-source-id: 3162f8b83431ebab2de53f9ba202e7ea8c339210
      c5e6d87b
  3. 06 Jan, 2017 6 commits
    • Zonr Chang's avatar
      __throw* functions seem to be available in LLVM 4.0 or above. · 084f9e18
      Zonr Chang authored
      Summary:
      __throw* functions exist in master branch but are not included in both
      libc++ 3.9.0 and 3.9.1. Expect them to appear in next LLVM release
      (which is 4.0).
      Closes https://github.com/facebook/folly/pull/536
      
      Reviewed By: yfeldblum, Orvid
      
      Differential Revision: D4377002
      
      Pulled By: smeenai
      
      fbshipit-source-id: 5dd311ca3ec43955f29dd1197fd8fbeb9564a7f6
      084f9e18
    • Christopher Dykes's avatar
      std::chrono'ize EventBase::setLoadAvgMsec · 02cae39d
      Christopher Dykes authored
      Summary: Modernization is good.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4377612
      
      fbshipit-source-id: adb03d8a92f25c8a792c8e7240a93ab20180b038
      02cae39d
    • Christopher Dykes's avatar
      std::chrono'ize EventBase::SmoothLoopTime · 7b4bb3f5
      Christopher Dykes authored
      Summary: Modernizing for the future.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4375539
      
      fbshipit-source-id: e3edf8dd6b77d3338f8cf58ed128bc5bce62da32
      7b4bb3f5
    • Igor Sugak's avatar
      fix gcc-5 build · f65d8d2c
      Igor Sugak authored
      Summary:
      ```lang=bash
      folly/test/SmallLocksBenchmark.cpp:212:18: error: use of undeclared identifier 'sqrt'
        double stdev = sqrt(accum / (results.size() - 1));
                       ^
      folly/test/SmallLocksBenchmark.cpp:221:20: error: use of undeclared identifier 'sqrt'
        double stddev2 = sqrt(variance);
                         ^
      2 errors generated.
      ```
      Add the missing header.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4386343
      
      fbshipit-source-id: 79c3dcae32c62f9b6d162862deabccf5fea7eaef
      f65d8d2c
    • Igor Sugak's avatar
      fix gcc-5 build · 36a9fc06
      Igor Sugak authored
      Summary:
      Clang with libgcc-5 reported:
      ```lang=bash
      folly/experimental/test/BitsTest.cpp:249:16: error: use of undeclared identifier 'pow'
        auto value = pow(2, bits) * (negate ? -2.0 : 2.0) / 3.0;
                     ^
      ```
      Add missing include statement, and elaborate with the namespace.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4385807
      
      fbshipit-source-id: a847dd439cd4c9f28ea8f222aa4ab60876949d13
      36a9fc06
    • Michael Lee's avatar
      make_unique is ambiguous with c++14 for some platforms · 918988e5
      Michael Lee authored
      Summary: Missing compatibility case for Android
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4384944
      
      fbshipit-source-id: 0b3e43fb284b6a71c6ae2a2162d1ea7cb99bc817
      918988e5
  4. 05 Jan, 2017 3 commits
    • Eric Niebler's avatar
      don't use assert in benchmarks. it gets stripped out in release mode. · 7ea05dfb
      Eric Niebler authored
      Summary: Critical tests in benchmarks should not be in asserts since they will be stripped out in release mode, which is the only mode interesting for benchmarks.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4384411
      
      fbshipit-source-id: 5237ab48f99ddcd2bce7a159fcf82900303efec2
      7ea05dfb
    • Yedidya Feldblum's avatar
      Namespace the UBSAN_DISABLE symbol · 9b7138e4
      Yedidya Feldblum authored
      Summary:
      [Folly] Namespace the `UBSAN_DISABLE` symbol.
      
      Symbols defined by Folly should typically be namespaced to Folly.
      
      Reviewed By: igorsugak
      
      Differential Revision: D4378401
      
      fbshipit-source-id: ff72f5f44e7c9d1bbf08efcec24bd3dc05d10ee7
      9b7138e4
    • Yedidya Feldblum's avatar
      Backport ceil, floor, round from C++17 std::chrono · cd578dbf
      Yedidya Feldblum authored
      Summary:
      [Folly] Backport `ceil`, `floor`, `round` from C++17 `std::chrono`.
      
      These functions for operating on `std::chrono::duration` and `std::chrono::time_point` values are useful
      
      Note: The implementations are derived from cppreference.com, which has a notice listing all content there as licensed under CC-BY-SA.
      
      Reviewed By: ericniebler
      
      Differential Revision: D4375603
      
      fbshipit-source-id: 36a098bf5f75db071c1670518fc42bbc6df2817d
      cd578dbf
  5. 04 Jan, 2017 4 commits
    • Yedidya Feldblum's avatar
      Keep the std::exception* or std::type_info* in folly::exception_wrapper · eaa278a5
      Yedidya Feldblum authored
      Summary:
      [Folly] Keep the `std::exception*` or `std::type_info*` in `folly::exception_wrapper`.
      
      In the case of construction with a `std::exception_ptr`. Instead of keeping a pair of `std::string`s, strictly losing information (not that we use any more information, but theoretically we could).
      
      Of note:
      * Shrinks the size of `folly::exception_wrapper`, in all cases, to 48 bytes. Down from 32 bytes + 2 S bytes on 64-bit architectures, where S is the size in bytes of `std::string`. In particular, `libstdc++`'s implementation is 32 bytes, while `libc++`'s and Folly's implementations are 24 bytes on 64-bit architectures, for total original sizes of 96 bytes or 80 bytes.
      * Allows to avoid rethrowing in `with_exception` in the case of an instance constructed with an `std::exception_ptr` plus an `std::exception&`.
      
      Reviewed By: ericniebler
      
      Differential Revision: D4369935
      
      fbshipit-source-id: 35155e0b271959a4878fe077fc911b17767a2358
      eaa278a5
    • Shoaib Meenai's avatar
      Add preprocessor macro to disable throw* definitions · dc938550
      Shoaib Meenai authored
      Summary:
      libc++ 4.0 and above define the throw* functions in `stdexcept`, so
      Folly doesn't need to define them itself. In case those definitions are
      backported to 3.9, add a Folly macro to skip the definitions regardless
      of the libc++ version number.
      
      Reviewed By: yfeldblum, Orvid
      
      Differential Revision: D4378102
      
      fbshipit-source-id: 674d98d7c448aa7e75bdd8b6e9fe965cd34a83d7
      dc938550
    • Yedidya Feldblum's avatar
      folly::_t and use it in folly::exception_wrapper · 815100a0
      Yedidya Feldblum authored
      Summary:
      [Folly] `folly::_t` and use it in `folly::exception_wrapper`.
      
      Intended in part for use in Folly code, but can be used outside.
      
      Instead of:
      
      ```lang=c++
      namespace folly {
      using original = //...
      using decayed = typename std::decay<original>::type;
      }
      ```
      
      In C++14:
      
      ```lang=c++
      namespace folly {
      using original = //...
      using decayed = std::decay_t<original>;
      }
      ```
      
      And in C++11:
      
      ```lang=c++
      namespace folly {
      using original = //...
      using decayed = _t<std::decay<original>>:
      }
      ```
      
      Not perfect, but better.
      
      HT ericniebler and https://github.com/eniebler/meta.
      
      Reviewed By: ericniebler
      
      Differential Revision: D4371539
      
      fbshipit-source-id: 9046d9caab73141b95f4bce4fb1af26e0c1ac739
      815100a0
    • Yedidya Feldblum's avatar
      2017 · ed8c80a0
      Yedidya Feldblum authored
      Summary: [Folly] 2017.
      
      Reviewed By: Orvid
      
      Differential Revision: D4378593
      
      fbshipit-source-id: 4a448228bb1ddbe191b6e8562483867a399be846
      ed8c80a0
  6. 03 Jan, 2017 3 commits
    • Steve O'Brien's avatar
      folly: ReadMostlySharedPtr fix for `getStdShared()` method · 38894440
      Steve O'Brien authored
      Summary:
      Fix this error:
      
        In file included from FooUtils.cpp:2:
        folly/experimental/ReadMostlySharedPtr.h:323:21: error: 'ptr_' is a private member of 'folly::detail::ReadMostlySharedPtrCore<Foo, folly::TLRefCount>'
              return impl_->ptr_;
                            ^
        ... in instantiation of member function 'folly::ReadMostlySharedPtr<Foo, folly::TLRefCount>::getStdShared' requested here:
                getSomeReadMostlySharedPtr().getStdShared();
                                             ^
        buck-out/dev/gen/folly/__default_headers__#default,headers/folly/experimental/ReadMostlySharedPtr.h:94:22: note: declared private here
          std::shared_ptr<T> ptr_;
                             ^
        1 error generated.
      
      The added test case repro's the above error (and the changes to the class fixes it).
      
      Alternatives include just making `ReadMostlySharedPtr` a friend class of `ReadMostlySharedPtrCore`, but that seems uglier than this fix, which was to simply use the public `getShared` method which already exists.
      
      As luck would have it, I had tried that, and also found that a `const ReadMostlySharedPtr` would still give some trouble because `getStdShared` was not marked `const`.  Fixed that too.  (I assume if a copy of a const `shared_ptr` member / such a member of a `const` instance is permissible, then the method should be const as well.  Plus it's const in the other `ReadMostlySharedPtr` class.)
      
      Reviewed By: djwatson
      
      Differential Revision: D4377690
      
      fbshipit-source-id: 8e9e778ca991fd04b0eb1e5762795d871ce0ee8d
      38894440
    • Yedidya Feldblum's avatar
      Drop the boost dependency from Traits.h and FBVector.h · 03a4c5bd
      Yedidya Feldblum authored
      Summary:
      [Folly] Drop the `boost` dependency from `Traits.h` and `FBVector.h`.
      
      Should not need it anymore with the currently supported compilers.
      
      Reviewed By: ericniebler
      
      Differential Revision: D4375572
      
      fbshipit-source-id: df890c07f49b0499d2d2d08aa21c226b2893281e
      03a4c5bd
    • Christopher Dykes's avatar
      Kill a dead constant in EventBase · 1807488d
      Christopher Dykes authored
      Summary: It's only accessible within EventBase, and is never used.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4375541
      
      fbshipit-source-id: a0c6d86a2b1968c37c67303c8411a23ed936d9d5
      1807488d
  7. 02 Jan, 2017 4 commits
    • Mathieu Baudet's avatar
      fbcode: remove unused includes from .cpp files without #if (but possibly #define) · b97b7d79
      Mathieu Baudet authored
      Summary: Same as D4312617 but this time not excluding source files with `#define`.
      
      Reviewed By: soumith
      
      Differential Revision: D4344811
      
      fbshipit-source-id: 5a314960c319f029c6737c8c8ac8224ec2f20218
      b97b7d79
    • Yedidya Feldblum's avatar
      Drop <boost/operators.hpp> as a dependency of FBVector.h · 9c20a858
      Yedidya Feldblum authored
      Summary:
      [Folly] Drop `<boost/operators.hpp>` as a dependency of `FBVector.h`.
      
      We can rough it.
      
      Reviewed By: wqfish
      
      Differential Revision: D4375986
      
      fbshipit-source-id: 6b8c16ca9a55341fee396a253f7ad0c4d0201b0e
      9c20a858
    • Yedidya Feldblum's avatar
      Move the traits factories up, and remove <boost/mpl/has_xxx.hpp> · ca73efa8
      Yedidya Feldblum authored
      Summary:
      [Folly] Move the traits factories up, and remove `<boost/mpl/has_xxx.hpp>`.
      
      Also, they now generate aliases to the types aliased by `std::true_type` and `std::false_type`. So now the API is entirely compatible with the requirements of `std::integral_constant` (because it is `std::integral_constant`).
      
      Reviewed By: wqfish
      
      Differential Revision: D4375944
      
      fbshipit-source-id: dfd41283f13d793f7fc1f173590cd93cdee39a10
      ca73efa8
    • Zonr Chang's avatar
      Add FOLLY_OPENSSL_HAS_ALPN and FOLLY_OPENSSL_HAS_SNI. · 7dabbf60
      Zonr Chang authored
      Summary:
      This expresses the intention of long predicate on OpenSSL version and
      OPENSSL_NO_TLSEXT more clearly.
      
      This also enables ALPN and SNI support when BoringSSL is in use.
      
      ALPN is an essential function to make HTTP/2 work when building Proxygen
      with BoringSSL.
      Closes https://github.com/facebook/folly/pull/534
      
      Reviewed By: Orvid
      
      Differential Revision: D4375391
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 009f311bceb0ee911d904d96a3e678a5f7241575
      7dabbf60
  8. 01 Jan, 2017 1 commit
    • Yedidya Feldblum's avatar
      Fix assorted missing includes · 827187dc
      Yedidya Feldblum authored
      Summary: Fix assorted missing includes.
      
      Reviewed By: wqfish
      
      Differential Revision: D4375902
      
      fbshipit-source-id: 2b32631857c8f94e505153d32932cdf97d8d0b33
      827187dc
  9. 31 Dec, 2016 1 commit
    • Petr Lapukhov's avatar
      Add more MSG_OOB tests for EventHandler · e1a15f96
      Petr Lapukhov authored
      Summary:
      Sending OOB messages allows for single byte to be sent truly out of band and placed in an OOB buffer. This byte can then be read (by default) independent from normal data.
      
      The two test-cases validate that
      
      (1) We can receive OOB and normal data on same socket
      (2) Sending OOB byte does not affect regular data
      
      NOTE: sending more than one byte usually means the OOB data interleaved with regular data.
      
      Reviewed By: alandau
      
      Differential Revision: D4370652
      
      fbshipit-source-id: a573dae7e5afba5a4a410be5371faf4f065c74e9
      e1a15f96
  10. 30 Dec, 2016 3 commits
    • Zbigniew Szymanski's avatar
      Move internal `decodeUtf8` method from json.cpp to public util Unicode.h · 67f7bb72
      Zbigniew Szymanski authored
      Summary:
      Moved decodeUtf8 -> folly::utf8ToCodePoint.
      Implementation was not changed to make sure no bugs are introduced.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4372739
      
      fbshipit-source-id: a015a9c47ece825e09e7c243fae454f21f99db80
      67f7bb72
    • Yedidya Feldblum's avatar
      Let Future::then call callbacks outside of the catch handler · 1d36d464
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `Future::then` call callbacks outside of the catch handler.
      
      And `Future::onError`.
      
      This makes the behavior of calls to `Future` callbacks with respect to currently-handled ("active") exceptions consistent - there will not be an active exception by the time the `Future` callback is called. (Unless `Future::then` or `Future::onError`, etc., is itself called with an active exception. Or unless the `Promise` is fulfilled, outside of the `Future` implementation code, with an active exception.)
      
      This will affect any code which tries to call `std::current_exception()` or `throw;` from within a `Future` callback, such as an `onError` handler. That code will crash. (It was incorrect anyway, and relied on misusing Folly Futures.)
      
      Reviewed By: ericniebler
      
      Differential Revision: D4372173
      
      fbshipit-source-id: 600b22e4db63c98358de29a6abcee807fbc53b0f
      1d36d464
    • Yedidya Feldblum's avatar
      Const-correctness for folly::exception_wrapper::with_exception with non-std::exception · 686092cb
      Yedidya Feldblum authored
      Summary:
      [Folly] Const-correctness for `folly::exception_wrapper::with_exception` with non-`std::exception`.
      
      This also lets us unify the various flavors of `with_exception` and `is_compatible_with`. And fix `is_compatible_with` for non-`exception` types.
      
      Reviewed By: ericniebler
      
      Differential Revision: D4364474
      
      fbshipit-source-id: 417edfd45f7cfba952ce961559da67769b7c41bc
      686092cb
  11. 29 Dec, 2016 7 commits
    • Eric Niebler's avatar
      folly::TryException inherits from std::logic_error, like... · 06649f43
      Eric Niebler authored
      folly::TryException inherits from std::logic_error, like std::bad_optional_access; becomes no-throw copyable
      
      Summary:
      folly::TryException was inheriting from std::exception and managing its own message in a std::string data member.
      That is suboptimal for the following reasons:
      
      1) The analagous std:: type, std::bad_optional_access, inherits from std::logic_error. According to the Principle of Least
         Astonishment, folly::TryException should follow suit.
      2) std::logic_error has a nothrow copy constructor. (This is typically implemented with a ref-counted string.)
         std::string does not. By explicitly managing its own message, folly::TryException picks up a throwing copy
         constructor. Exception classes should try to be nothrow copyable.
      3) With most stdlib implementations, std::string is larger by a lot than the std:: exceptions. By changing
         folly::TryException as suggested, its size drops from 40 bytes to 16 on clang and gcc >=5.0.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4368760
      
      fbshipit-source-id: 327f78f428419ccf9c7af3e0f57cc478d147fb37
      06649f43
    • Eric Niebler's avatar
      folly::FutureException inherits from std::logic_error, like std::future_error;... · 42ba1a22
      Eric Niebler authored
      folly::FutureException inherits from std::logic_error, like std::future_error; becomes smaller and nothrow-copy
      
      Summary:
      folly::FutureException was inheriting from std::exception and managing its own message in a std::string data member.
      That is suboptimal for the following reasons:
      
      1) The analagous std:: type, std::future_error, inherits from std::logic_error. According to the Principle of Least
         Astonishment, folly::FutureExpception should follow suit.
      2) std::logic_error has a nothrow copy constructor. (This is typically implemented with a ref-counted string.)
         std::string does not. By explicitly managing its own message, folly::FutureException picks up a throwing copy
         constructor. Exception classes should try to be nothrow copyable.
      3) With most stdlib implementations, std::string is larger by a lot than the std:: exceptions. By changing
         folly::FutureException as suggested, its size drops from 40 bytes to 16 on clang and gcc >=5.0.
      
      Also, I took the liberty of fixing some copy-pastas that gave some of these exception types explicit default
      constructors.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4367909
      
      fbshipit-source-id: 1639d404237493f929db6116a760c2d0e599877d
      42ba1a22
    • Bi Xue's avatar
      Make FunctionRef support bool operator · 42f55fa5
      Bi Xue authored
      Summary:
      To support following code:
      ```
      void foo(folly::FunctionRef<void(void)> callback = {}) {
        if (callback) {
          callback();
        }
      }
      ```
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4372296
      
      fbshipit-source-id: 7d21e6a44b6f6b046b424f0139465511dbae7b8b
      42f55fa5
    • Giuseppe Ottaviano's avatar
      Avoid shadowing warnings in SYNCHRONIZED · e910dd4b
      Giuseppe Ottaviano authored
      Summary: If two `SYNCHRONIZED` blocks are nested the internal `SYNCHRONIZED_*` variables can be compatible shadows (`SYNCHRONIZED_state` always is), so GCC will issue a warning with `-Wshadow-compatible-local`. This diff disambiguates the variable names for each `SYNCHRONIZED` block (as long as they appear on different lines).
      
      Reviewed By: yfeldblum, philippv
      
      Differential Revision: D4371263
      
      fbshipit-source-id: b467a1a2651667c679382a1cc1eaa28f7ee4e6b3
      e910dd4b
    • Anirudh Ramachandran's avatar
      Add OpenSSL portability layer · 87659d07
      Anirudh Ramachandran authored
      Summary:
      Enable folly to build with OpenSSL alternatives (e.g., BoringSSL).
      
      Some SSL-related tests are disabled:
      
       - Async session cache ones (BoringSSL has an async cache impl but with a different API)
       - TFO tests
       - Some changes to error tests which expect specific error strings. This is
         flaky as a test because it will break everytime even within a version, so we
         should fix that first.
      
      This should be a noop for OpenSSL 1.0.2.
      
      BoringSSL commit used is 35c8afd3143289c99aa3820e01950c564d7aced8 (10/26/2016)
      
      Closes: https://github.com/facebook/folly/issues/198
      
      Reviewed By: siyengar
      
      Differential Revision: D3280382
      
      fbshipit-source-id: 4141d992e0d8dd797ac4af479cfe90844a23278f
      87659d07
    • Yedidya Feldblum's avatar
      folly::copy · ec5f59cf
      Yedidya Feldblum authored
      Summary:
      [Folly] `folly::copy`.
      
      Usable when you have a function with two overloads:
      
          class MyData;
          void something(MyData&&);
          void something(const MyData&);
      
      Where the purpose is to make copies and moves explicit without having to spell out the full type names - in this case, for copies, to invoke copy constructors.
      
      When the caller wants to pass a copy of an lvalue, the caller may:
      
          void foo() {
            MyData data;
            something(folly::copy(data)); // explicit copy
            something(std::move(data)); // explicit move
            something(data); // const& - neither move nor copy
          }
      
      Reviewed By: markisaa, ericniebler
      
      Differential Revision: D3462023
      
      fbshipit-source-id: 6c777be288f2a7012c1b4b46dc988890b8662595
      ec5f59cf
    • Philip Pronin's avatar
      nuke UNSYNCHRONIZED · 1c3b25b2
      Philip Pronin authored
      Summary:
      API of `UNSYNCHRONIZED` is confusing as if you have two nested
      `SYNCHRONIZED` blocks, `UNSYNCHRONIZED` always unlocks the inner-most,
      even if you pass in the variable name used in the outer `SYNCHRONIZED`
      block.
      
      The macro was marked as "deprecated" in D3526489, remove it here.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4371297
      
      fbshipit-source-id: 13ddc1ff77cb3d5045844c5ade0e95dbe2bccf6d
      1c3b25b2