- 11 Dec, 2015 3 commits
-
-
Louis Brandy authored
Summary: If we're going to have a constructor for it, we should have operator=. Otherwise, gcc-4.9 goes via the copy constructor effectively "ignoring" the attempted nesting for e.g.. ``` d = { other_dynamic }; // Should be ARRAY containing dynamic ``` NOTE: this only fixes gcc-4.9, there's still issues in clang. Reviewed By: yfeldblum Differential Revision: D2745180 fb-gh-sync-id: 667787c788fc7c131d8a34c608c355f5b875be50
-
Andrii Grynenko authored
Reviewed By: alikhtarov Differential Revision: D2741459 fb-gh-sync-id: c4bd068cf735ae25364edba40960096fb35e8c43
-
Philip Pronin authored
Summary: By default signal handlers are run on the signaled thread's stack. In case of stack overflow running the `SIGSEGV` signal handler on the same stack leads to another `SIGSEGV` and crashes the program Use `SA_ONSTACK`, so alternate stack is used (only if configured via `sigaltstack`). Reviewed By: luciang Differential Revision: D2747021 fb-gh-sync-id: 48388acd6147e2919412ec32acfca1ca76f22a16
-
- 10 Dec, 2015 6 commits
-
-
Yedidya Feldblum authored
Summary: [Folly] Use `SharedMutex` as the default mutex type in `Synchronized`. `folly::SharedMutex` is, overall, a faster mutex than `boost::shared_mutex`. Let's upgrade. Reviewed By: nbronson Differential Revision: D2743132 fb-gh-sync-id: e36881495e8e1002cd481607e05e555c5da19b9a
-
Neel Goyal authored
Summary: Revert D2741855 Reviewed By: mzlee Differential Revision: D2744015 fb-gh-sync-id: b1e9b0a5ab95cb988d2b5c08c86139452b092465
-
Barney Moss authored
Summary: Unit test showing array assignment problem on gcc 4.9 Reviewed By: lbrandy Differential Revision: D2739900 fb-gh-sync-id: 6b0fde956672b8248fbd4e620fd112195c45c646
-
Andrii Grynenko authored
Reviewed By: pavlo-fb Differential Revision: D2743230 fb-gh-sync-id: 4a52d1758a43fd103318bbe0913776340eaa6af7
-
Arjen Roodselaar authored
Summary: There is slight drift in external deps between the TARGETS and automake files, keeping tests from linking in the 'make check' step when building folly outside of fbcode. Reviewed By: yfeldblum Differential Revision: D2740482 fb-gh-sync-id: ae6243f9bb112a7d2680017b3d577a1f23ef4f60
-
Neel Goyal authored
Summary: Update the protocol pick logic to use discrete_distribution Reviewed By: siyengar Differential Revision: D2741855 fb-gh-sync-id: 244bd087124a7a9584a1108fe8f8150093275878
-
- 09 Dec, 2015 3 commits
-
-
Andrii Grynenko authored
Summary: This also introduces a new try_get_fast() API which returns ReadMostlySharedPtr. We should eventually migrate all users onto this API. Reviewed By: elsteveogrande Differential Revision: D2706745 fb-gh-sync-id: d558d705f431fc6147334c188fd0c6156644ba5c
-
Alan Frindell authored
Summary: With openssl-1.0.2 and later add support for ALPN. Clients can request NPN only, but the default is to support either (client will send ALPN list, server will send NPN advertisement if ALPN is not negotiated). Reviewed By: siyengar Differential Revision: D2710441 fb-gh-sync-id: a8efe69e1869bbecb4ed9e0a513448fcfdb21ca6
-
Shijin Kong authored
Summary: EINTR should be retried Reviewed By: afrind Differential Revision: D2735879 fb-gh-sync-id: 6f25cd26e29ab8e7e13a3d63f24bf2d104c14809
-
- 08 Dec, 2015 4 commits
-
-
Chad Parry authored
Summary: This is an experimental diff that may improve the performance of `HHWheelTimer::cancelAll`. If there are no timers to cancel, then it can bail early. Since perflab is unlikely to be conclusive, and since this diff looks like a strict improvement, I'll proceed with landing it. Reviewed By: djwatson Differential Revision: D2735297 fb-gh-sync-id: 9f5a811ee6d9fa9434576e9abd3ef3443a7579b7
-
Andrii Grynenko authored
Reviewed By: pavlo-fb Differential Revision: D2708425 fb-gh-sync-id: 665d077210503df4f4e8aa8f88ce5b9b277582f3
-
Chip Turner authored
Summary: New version. Reviewed By: cyan Differential Revision: D2730844 fb-gh-sync-id: 4305bdfba2e8d25eba295bbf3f13a140c0d04a1c
-
Neel Goyal authored
Summary: Mark some methods as virtual. This makes writing some better unit tests on the associated task possible. Reviewed By: siyengar Differential Revision: D2730126 fb-gh-sync-id: f79f7632e873cb218bb49883d9b53beea7bb96e7
-
- 07 Dec, 2015 2 commits
-
-
John Sherwood authored
Summary: when a promise is broken, add type info to the message. This will allow for some small improvements to debugging errors from broken promises, namely giving developers a slightly more refined target to grep for. Reviewed By: fugalh Differential Revision: D2725575 fb-gh-sync-id: b92edbde874e63eaeab97395da7bb52f76968800
-
Kyle Nekritz authored
Reviewed By: djwatson Differential Revision: D2720027 fb-gh-sync-id: 1d56aabedeaf65a5d48e152eaee5c81695be7620
-
- 06 Dec, 2015 5 commits
-
-
Bartek Ryniec authored
Summary: Adding a flag in `folly::json::serialization_opts` that allows you to request all numbers to be parsed into strings. This saves you from exceptions being thrown by `folly::parseJson` if it encounters numbers that wouldn't fit in int64. Reviewed By: yfeldblum Differential Revision: D2713039 fb-gh-sync-id: 4f3d0d20f3012efd6229adf895200a3901bb4493
-
Kyle Nekritz authored
Reviewed By: mzlee Differential Revision: D2709222 fb-gh-sync-id: 67a00a49bbcef5572b6092d7bfba1842d985e643
-
Kyle Nekritz authored
Summary: getRawBytesReceived and getRawBytesWritten should be used instead. Reviewed By: mzlee Differential Revision: D2708684 fb-gh-sync-id: 2de87dc2b8c3466f94293a3d7df89fc5fce3a00f
-
Alexey Spiridonov authored
Summary: In rare cases, it is required to run code **in the child process**, before it calls `exec()` because you need to change the state of the process **before** the child binary gets to run. This diff adds a callback to permit this. The callback is deliberately harder to use than an `std::function`, because you **REALLY HAVE TO KNOW WHAT YOU ARE DOING** to use this. And you have to check your work three times. Even glog `LOG()` must not be called from inside this callback. Your random library of choice is also probably unsafe. This diff is primarily applicable to job managers and shells. For example, these tasks benefit from this callback: adding a child to a Linux `cgroup`, twiddling its various POSIX process attributes. Implementing a correct callback for the post-vfork environment is fraught with peril. Read http://ewontfix.com/7/, and the docstrings in this diff. Reviewed By: yfeldblum Differential Revision: D2688323 fb-gh-sync-id: aae49e2b3957ca845895acca26e9cb44df1afc07
-
Umair Sadiq authored
Summary: Currently, the tryRunAfterDelay implicitly converts a negative delay in int to unsigned int. With this change, the api makes it clear than only unsinged int is accepted as valid delay Reviewed By: yfeldblum Differential Revision: D2710034 fb-gh-sync-id: cb3c6b91bb86bbe07fa0e590b2ea871242d19745
-
- 03 Dec, 2015 1 commit
-
-
Steve O'Brien authored
Summary: Change mutex to MicroSpinLock, for constexpr-ctor-ness on OSX. Fixes this error seen on mac: ThreadLocalDetail.h:202:38: note: non-literal type 'std::mutex' cannot be used in a constant expression Reviewed By: ldemailly Differential Revision: D2713511 fb-gh-sync-id: bc1c34b4a0ee21347278aa368b408f286345e050
-
- 02 Dec, 2015 5 commits
-
-
Steve O'Brien authored
Summary: Small, silly bug which is triggered when there are no keys to unregister, invalidating the current size of the structure. Reviewed By: yzhan Differential Revision: D2712604 fb-gh-sync-id: f6f031936d8e4e458b49c08714f42cb2eec4c4fe
-
Tudor Bosman authored
Summary: Comes in handy, and std::experimental::optional has it. Reviewed By: yfeldblum Differential Revision: D2708324 fb-gh-sync-id: 87cdf2449f356d3baf9fb56a608e9c43d8fe79ae
-
Steve O'Brien authored
Summary: Since this is used in so many places during the program's static-initialization (at startup), this class itself could be (has been demonstrated to be) a point of SIOF problems itself. Made this class constexpr-constructible, so it doesn't need to be part of static initialization, making it SIOF-proof. Reviewed By: luciang Differential Revision: D2709231 fb-gh-sync-id: f248c9f2848c09045e000cfdc03636d847e522c9
-
Chad Parry authored
Summary: This is a //tiny// documentation change. I noticed that there are lots of places in the codebase where people follow this recommended usage of `with_exception` in an if–else chain, (e.g., https://fburl.com/181606454). IMHO, a short-circuiting `||` operator is easier to read and write. Reviewed By: yfeldblum Differential Revision: D2687840 fb-gh-sync-id: 6354555aeba81dcfe7adf17e7e573de0b1206b37
-
Andrii Grynenko authored
Summary: facepaw Reviewed By: djwatson Differential Revision: D2709030 fb-gh-sync-id: 20fe50bc70e97c4fedeae8fd271a4de70fa0e805
-
- 01 Dec, 2015 6 commits
-
-
Yedidya Feldblum authored
Summary: [Folly] Avoid requiring a suppression (`unevaluated-expression`). I am not a fan of suppressing warnings. This warning comes from the internals of gtest, but anyway. Replace with something that does not trigger the warning. Reviewed By: Gownta Differential Revision: D2706279 fb-gh-sync-id: 2ecac1d230308a8fd21a69565193c52585526448
-
Daniel Andersson authored
Summary: Add template parameters to support arbitrary types when looking up a key. This is useful to avoid the cost of 'materializing' a key which is likely to be present in the array (or, alternatively, switching on a tagged union KeyT). Use the new capability to greatly simplify the lookup logic in HHVMs static string table. Reviewed By: nbronson Differential Revision: D2662451 fb-gh-sync-id: 707fa033f350b80ca8080af17f1a8a74c59f2e88
-
Jim Meyering authored
Summary: Using -Werror and -Wfloat-conversion was causing failure in code that is deliberately performing that conversion. Add explicit casts to avoid the warnings/errors. Here are two of the diagnostics: ./folly/Conv.h: In instantiation of "typename std::enable_if<std::is_floating_point<_Tp>::value, Tgt>::type folly::to(folly::StringPiece) [with Tgt = float; typename std::enable_if<std::is_floating_point<_Tp>::value, Tgt>::type = float; folly::StringPiece = folly::Range<const char*>]": ./thrift/lib/cpp2/protocol/SimpleJSONProtocol.tcc:687:28: required from "T apache::thrift::SimpleJSONProtocolReader::castIntegral(const string&) [with T = float; std::string = std::basic_fbstring<char>]" ./thrift/lib/cpp2/protocol/SimpleJSONProtocol.tcc:680:26: required from "uint32_t apache::thrift::SimpleJSONProtocolReader::readJSONKey(T&) [with T = float; uint32_t = unsigned int]" ./thrift/lib/cpp2/protocol/SimpleJSONProtocol.tcc:654:16: required from "uint32_t apache::thrift::SimpleJSONProtocolReader::readInContext(T&) [with T = float; uint32_t = unsigned int]" ./thrift/lib/cpp2/protocol/SimpleJSONProtocol.tcc:1035:34: required from here ./folly/Conv.h:1222:31: error: conversion to "float" from "std::enable_if<true, double>::type {aka double}" may alter its value [-Werror=float-conversion] ./folly/Conv.h: In instantiation of "typename std::enable_if<((std::is_integral<_Tp2>::value && std::is_floating_point<_Tp>::value) || (std::is_floating_point<_DInputType>::value && std::is_integral<_Tp>::value)), Tgt>::type folly::to(const Src&) [with Tgt = long int; Src = double; typename std::enable_if<((std::is_integral<_Tp2>::value && std::is_floating_point<_Tp>::value) || (std::is_floating_point<_DInputType>::value && std::is_integral<_Tp>::value)), Tgt>::type = long int]": ./folly/dynamic-inl.h:636:51: required from "T folly::dynamic::asImpl() const [with T = long int]" ./folly/dynamic-inl.h:384:64: required from here ./folly/Conv.h:1245:16: error: conversion to "long int" from "double" may alter its value [-Werror=float-conversion] This change deserves a little more explanation: - return ceil((double(sizeof(IntegerType) * CHAR_BIT) * M_LN2) / M_LN10); + return (unsigned int)(ceil(sizeof(IntegerType) * CHAR_BIT * M_LN2 / M_LN10)); In addition to adding the cast to destination type, I have also removed the unnecessary cast to double of the first product (there is not risk that it will overflow, and no need to promote to double, there), and I have also removed the grouping parentheses, since the standard left-to-right evaluation works just fine here. Reviewed By: Gownta, yfeldblum Differential Revision: D2703928 fb-gh-sync-id: 23b49281d9120d106f1fdbd30921e8f39c01367d
-
Yedidya Feldblum authored
Summary: CodeMod: Use the `ExceptionWrapper::with_exception` variant that deduces exception types. Since we must specify the exception type in the lambda arg, and there is a variant of `ExceptionWrapper::with_exception` that deduces the type of the exception from the type of the lambda arg, we don't need to specify the exception type again as a template parameter anymore. Reviewed By: meyering Differential Revision: D2694895 fb-gh-sync-id: 505469f9008973a315e836f356e5db97df4ec921
-
Jim Meyering authored
Summary: Do not negate signed numbers like INT_MIN or INTMAX_MIN, since that would evoke undefined behavior. Otherwise, the test (below) would fail with this run-time error: [ RUN ] Conv.Integral2String folly/Conv.h:521:47: runtime error: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself Reviewed By: markisaa Differential Revision: D2704195 fb-gh-sync-id: 4036437fb972109672004163880078127e7df797
-
Yedidya Feldblum authored
Summary: [Folly] Avoid deprecated `Singleton<T>::get()` in `folly/futures`. Changes `getTimekeeperSingleton()` to return a `shared_ptr<Timekeeper>`, and patches its call-sites. Additionally, have the call-sites keep the singleton instance alive for the duration that it is being directly used. Reviewed By: ddrcoder Differential Revision: D2702361 fb-gh-sync-id: 82b72ee514dc4f2a7f7522af8b2e92b34df063d6
-
- 26 Nov, 2015 3 commits
-
-
Andrii Grynenko authored
Summary: get_weak() is always used with .lock(), but try_get() is actually more performant than get_weak().lock(). Using get_weak() to store a weak_ptr and keep locking is not safe in fork scenarios. Reviewed By: yfeldblum Differential Revision: D2694223 fb-gh-sync-id: 908d44293ffd9b3782152d43e28d5de172d1654a
-
Yedidya Feldblum authored
Summary: [Folly] Fix `ExceptionWrapper::with_exception` to support lvalue ref functors. Ex: auto handler = [&](const std::runtime_error& e) { handle_runtime_error(e); }; exception_wrapper wrap = get_some_exception_wrapper_from_context(); wrap.with_exception(handler); // broken before this diff, fixed after Reviewed By: markisaa Differential Revision: D2698680 fb-gh-sync-id: 4976ba08e3601e22891d00d79a5dae5118887b71
-
Andrii Grynenko authored
Summary: This changes ReadMostlySharedPtr API to have 3 types: MainPtr, WeakPtr, SharedPtr. MainPtr and SharedPtr are equivalents of std::shared_ptr, and WeakPtr is an equivalent of std::weak_ptr. The only difference is that it can only be a single MainPtr, and while it's alive copying SharedPtr/WeakPtr or WeakPtr doesn't require atomic operations (and thus can be more performant than std::shared_ptr). Unlike original ReadMostlySharedPtr API, there're no thread-safety guarantees between reset() and getShared() for ReadMostlySharedPtr. ReadMostlySharedPtr can work with different RefCount implementations. This diff introduces RCURefCount (which is currently using liburcu) and TLRefCount. Reviewed By: djwatson Differential Revision: D2683572 fb-gh-sync-id: a7a03af4b1cf5f81a613368c6eebe70b2eaef064
-
- 25 Nov, 2015 2 commits
-
-
Mark Isaacson authored
Summary: So far this is a speculative fix.. I am waiting to see the results from the Ubuntu machine, but I suspect this is the problem. Reviewed By: bugok Differential Revision: D2697600 fb-gh-sync-id: e33d452a52c5ace2b7401d6495621ce68a5076b5
-
Giuseppe Ottaviano authored
Summary: See D2696092 Reviewed By: meyering Differential Revision: D2696360 fb-gh-sync-id: 2cfa9258be899a93a58c59dae70a10fef6f457c8
-