- 09 Feb, 2021 5 commits
-
-
Shai Szulanski authored
Summary: Combining CancellationTokens is a common pattern in user code, which requires the user to manage a CancellationSource and attach a callback per token to be merged: ``` folly::CancellationSource source; folly::CancellationCallbacki cb1{ std::move(token1), [&] { source.requestCancellation(); }}; folly::CancellationCallback cb2{ std::move(token2), [&] { source.requestCancellation(); }}; ... co_await co_withCancellation(source.getToken(), ...); ``` This diff adds the functionality to folly: ``` co_await co_withCancellation(folly::CancellationToken::merge(token1, token2, ...), ...); ``` This diff subclasses CancellationState for simplicity. If the extra vtable ptr is a concern, we can instead template CancellationState to combine them, but that would come with a compilation speed penalty. Reviewed By: yfeldblum Differential Revision: D26277772 fbshipit-source-id: 169f65b4cf8f7f10f2800fb7797bb09379ecc239
-
Yedidya Feldblum authored
Summary: Fix the uncaught-exception termination message expectations in `folly/lang/ExceptionTest.cpp` under libc++. Reviewed By: markisaa Differential Revision: D26328622 fbshipit-source-id: 2e2f9fce93c65556508d99d1f7b80f0971f35c0c
-
Dan Melnic authored
Summary: Lower min capacity so the test succeeds when ulimit -l has a lower value Reviewed By: yfeldblum Differential Revision: D26321362 fbshipit-source-id: 9d2c41fbbc190f46a6174c3f847943e13f5bea6c
-
Victor Zverovich authored
Summary: Removed deprecated folly format APIs. Reviewed By: yfeldblum Differential Revision: D26317507 fbshipit-source-id: 67f42d059088946a34e77c944befa4dcb24d8673
-
Xavier Deguillard authored
Summary: I've been trying to get EdenFS to compile on an M1 mac, and openssl only support these starting with 1.1.1i. From their changelog: *) Add support for Apple Silicon M1 Macs with the darwin64-arm64-cc target. [Stuart Carnie] Let's start by upgrading openssl. Reviewed By: fanzeyi Differential Revision: D26318433 fbshipit-source-id: dfe1a06ee7061dfcd026b0347eb050155895ebd9
-
- 07 Feb, 2021 1 commit
-
-
Yedidya Feldblum authored
Summary: Reexport `coroutine_handle` from `folly/experimental/coro/Coroutine.h`, which wraps inclusion of `experimental/coroutine`. Differential Revision: D26227588 fbshipit-source-id: 32cdb2b6d87e90065bf9f140716d63670c04db5f
-
- 06 Feb, 2021 3 commits
-
-
Alex Snast authored
Summary: Similar to XLOG_EVERY_MS but for formatted messages. Reviewed By: yfeldblum Differential Revision: D26296133 fbshipit-source-id: 92d2e240d70cf40b903f19b0350c6d9cc0daa1fb
-
Andrii Grynenko authored
Differential Revision: D26265450 fbshipit-source-id: 0cefa65feb3fc3b76c1b8b8a9059dc4d321c6751
-
Mikhail Shatalov authored
Summary: ...to avoid additional `get()` call if we need the emplaced object right after. Reviewed By: yfeldblum Differential Revision: D26238594 fbshipit-source-id: a66396173a27ac684b403b3c0c576be50c39dde2
-
- 05 Feb, 2021 9 commits
-
-
Mikhail Shatalov authored
Summary: `getOrCreateFn()` is prone to undefined behavior as it returns `nullptr` reference if factory function returns a `nullptr` or empty `std::shared_ptr<T>`, or if `emplace(evb, nullptr)` is called. This diff adds `DCHECK`s to enforce non-nulls. Note that `getOrCreate()` is not affected as it uses `std::make_shared` under the hood that is guaranteed to have a new object constructed. Differential Revision: D26246552 fbshipit-source-id: b7bc7164841b70fc0889c782438bf96a61857bbd
-
Xavier Deguillard authored
Summary: EdenFS has a use-case for this macro but with 10+ arguments. Raise the maximum number of arguments from 7 to 15 to permit this. Reviewed By: yfeldblum Differential Revision: D26268587 fbshipit-source-id: be0b0579d854a93dc2983706a253370fe05905df
-
Dan Melnic authored
Summary: Add support for io_uring min capacity. This should allow us to create io_uring instances even memory is fragmented and the kernel cannot allocate contiguous physical memory for capacity CQ entries (SQ is usually much smaller). Reviewed By: kevin-vigor Differential Revision: D26252442 fbshipit-source-id: f4e3bd4f00d21321b77d4e1452400689dbca1073
-
Yedidya Feldblum authored
Summary: Add `XLOG_FIRST_N` log function. Reviewed By: simpkins Differential Revision: D26184283 fbshipit-source-id: 23081f759897bbf7949ce603f8e5edb29869b40d
-
Dan Melnic authored
Summary: Remove FOLLY_UNLIKELY from IoUringBackend::eb_event_base_loop Reviewed By: yfeldblum Differential Revision: D26272113 fbshipit-source-id: de280347908e5448cc97ffc1e1be3100cf6cd4b1
-
Yedidya Feldblum authored
Summary: Reexport `suspend_always`, `suspend_never` from `folly/experimental/coro/Coroutine.h`, which wraps inclusion of `experimental/coroutine`. Differential Revision: D26215623 fbshipit-source-id: 5dbe5dba67e0c4dcb5a54b00753937c39833d3a7
-
Yedidya Feldblum authored
Summary: Rely on C++17 syntactic copy elision in `DelayedInit` to simplify and write `try_emplace` in terms of `try_emplace_with`. Reviewed By: praihan Differential Revision: D26260351 fbshipit-source-id: 590fdfed55ee325ed8a8ae4fa68c1db0bebf1545
-
Yedidya Feldblum authored
Summary: Move the libfmt portability code into `folly/portability/` and revise it only to mutate folly's namespace. Reviewed By: Orvid Differential Revision: D26182824 fbshipit-source-id: e0b72f523dfeac7ff7799ff2104a1146032dfbf3
-
Yedidya Feldblum authored
Summary: Let folly coro headers always be buildable whether or not coroutines are available. They may just be empty apart from transitive includes. Reviewed By: iahs Differential Revision: D26191449 fbshipit-source-id: 5865ce5edb13f97624b9f60c45c045886fdf0bfb
-
- 04 Feb, 2021 4 commits
-
-
Misha Shneerson authored
Summary: Currently, when C++ threads communicate with python's event loop, they place the items on the queue, notify the event loop, and when even loops starts running, they would consume all items from this queue at once. The downside of this approach is that we are unable to deprioritize the upstream tasks to yield to internal python tasks. However, such ability to yield is fundamental to how Thrift approaches load shedding under overload. In this diff we change the approach to take only a single item from the queue at a time. Notice that if queue is not emptied, the consumer will notify the event loop to consume from this queue on the next iteration of the loop. Reviewed By: zhxchen17 Differential Revision: D26228933 fbshipit-source-id: 827d21df12b65d518109151cb150cd45e513da57
-
Yedidya Feldblum authored
Summary: Tweaks to `folly::DelayedInit`: * No potential for ambiguity in placement-new by using `::new` and casting the address to `void*`. * Helper functions `slot` and `store` simplify `try_emplace_with` and `try_emplace`. * `try_emplace_with` and `try_emplace` are no longer `const`-qualified, removing the need for `mutable` qualifiers. The emplacement members should not be `const`-qualified since they are not semantically non-modifying. The `const` qualifier signals semantic non-modification. While it is the case that there are customs around `const` qualifiers and concurrency, these customs are not the core meaning of `const`. Reviewed By: praihan Differential Revision: D25919779 fbshipit-source-id: 95e5c4b4abf5285fbb00dddda1192998baf6ee59
-
Maged Michael authored
Summary: The change aims to make it easier to catch user bugs of using the map during or after its destruction in optimized modes without ASAN. The changes are: - Clear the buckets_ and chunks_ pointers in the corresponding destructors. - Add DCHECK-s of buckets_ (or chunks_) in other member functions when non-null values are expected. Reviewed By: davidtgoldblatt Differential Revision: D26232735 fbshipit-source-id: 14f0c11e10997773efb78c7275db99932dd19703
-
Nick Cooper authored
Summary: When modifying code that lacks alternative variations, there is only a 'HEAD' benchmark - so it can be useful to keep a version of these results for latter printing in the format of a relative benchmark. Add a new flag to simplify this use-case, --bm_relative_to: A flag taking the path to a JSON-verbose formatted dump, which will be used when printing (in non-JSON-mode) to produce output relative to the provided prior dump. Usage: - generate a JSON benchmark dump, use "--bm_json_verbose" $ your_benchmark_binary --benchmark --bm_json_verbose old-json - run a benchmark printing a comparison to an old dump: $ your_benchmark_binary --benchmark --bm_relative_to old-json Note: You can also use bm_json_verbose and bm_relative_to at the same time, this will print relative results and update the JSON dump Reviewed By: luciang Differential Revision: D26214397 fbshipit-source-id: 8134b74604b7bb5037934205e8eee5e3ffc27f15
-
- 03 Feb, 2021 7 commits
-
-
Pranjal Raihan authored
Summary: If `T` is greater than 4-byte aligned, then `compact_once_flag` brings no size improvements. We can use `once_flag` in these cases, which has a better mutex (`folly::SharedMutex` rather than `folly::MicroLock`). Reviewed By: yfeldblum Differential Revision: D26214262 fbshipit-source-id: ea15376ea892df42cc9d3a6eac3da458fe0564a8
-
Orvid King authored
Summary: Original commit changeset: 149b780350bf Reviewed By: zaxy78 Differential Revision: D26222637 fbshipit-source-id: 29bc017be6619165cbd497c27c7843fd95e345b1
-
Andrew McFague authored
Summary: This violates some expectations for how this function should be called, so explicitly allow this to be passed as a reference. Reviewed By: yfeldblum Differential Revision: D26215425 fbshipit-source-id: 29cff0407ec10ab61970d32da083110d1b609fbb
-
Orvid King authored
Summary: Non-uclibc android wasn't getting folly::remainder defined, so fall back to the STL in that case. Reviewed By: yfeldblum Differential Revision: D26196078 fbshipit-source-id: 149b780350bf4aaf6917ecce5e4718c91815c744
-
Nick Cooper authored
Summary: As above. Reviewed By: luciang Differential Revision: D26213601 fbshipit-source-id: e2eb639d0059e20cfd6828be669c62491e5ad9c4
-
Yedidya Feldblum authored
Summary: Add a new concept of a safe-point to folly::Task<...> with implementation-defined semantics. Example usage: ```lang=c++ Task<> co_something() { while (is_work_available()) { co_await co_safe_point; do_work(); } } ``` Previously, a coroutine function which would cancel itself if cancellation is requested would need to spell cancellation pass-through a bit less elegantly: ```lang=c++ Task<> co_something() { while (is_work_available()) { auto token = co_await co_current_cancellation_token; if (token.isCancellationRequested()) { co_yield co_cancel; } do_work(); } } ``` Initial semantics include: * If cancellation has been requested, finish the coroutine with cancellation. * Otherwise, continue the coroutine. In the future, it may be wise to add additional behavior: * If the coroutine has been running for too long since its previous resumption, reschedule it. Reviewed By: aary Differential Revision: D25861265 fbshipit-source-id: 6da896f1529d652bfe222cf3a70e9dbe19778510
-
Yedidya Feldblum authored
Summary: Use `LOG_FIRST_N` in `MemoryIdler` rather than reimplement it. Reviewed By: praihan Differential Revision: D26185702 fbshipit-source-id: c1045ef8bf6aabefa4c0806c35c156539d6e594f
-
- 02 Feb, 2021 1 commit
-
-
Dan Melnic authored
Summary: Delay registration of the timer and signal fds until running the loop first time On some Linux kernel versions, io_uring will remove any fd registrations on thread exit. So creating the backend in a thread that exits later will cause us not to receive timer and signal fd events. Reviewed By: kevin-vigor Differential Revision: D26200805 fbshipit-source-id: dc3025964deb3cf87bf3e5a27141abcdb8698caf
-
- 01 Feb, 2021 2 commits
-
-
Parvez Shaikh authored
Summary: moving to 1.7.0 for open source github sai also build fake with 1.7.0 Differential Revision: D26152792 fbshipit-source-id: 02e7bfb218d200666e506e3115ee8f5dba5ece0a
-
Misha Shneerson authored
Differential Revision: D26163397 (https://github.com/facebook/folly/commit/7c9f69f9c72b598c5dd942d93a94f371c6fa901d) Original commit changeset: 48cd6cb57c48 fbshipit-source-id: fe0dd79a4e9ec77194cabf0edc697d9746542d3c
-
- 30 Jan, 2021 2 commits
-
-
Misha Shneerson authored
Summary: Currently, when C++ threads communicate with python's event loop, they place the items on the queue, notify the event loop, and when even loops starts running, they would consume all items from this queue at once. The downside of this approach is that we are unable to deprioritize the upstream tasks to yield to internal python tasks. However, such ability to yield is fundamental to how Thrift approaches load shedding under overload. In this diff we change the approach to take only a single item from the queue at a time. Notice that if queue is not emptied, the consumer will notify the event loop to consume from this queue on the next iteration of the loop. Reviewed By: andriigrynenko Differential Revision: D26163397 fbshipit-source-id: 48cd6cb57c48ea67dce4eb5f0de6db5b0feb75ac
-
William McDonald authored
Summary: Previous version does not compile when converting from `const folly::Optional` to `std::optional`. This happens in a typical `for (const auto& x : vec)` where `x` is or contains `folly::Optional`. Add a new `const` version in case people case about `Value&` ctor as opposed to `const Value&`. Reviewed By: iahs Differential Revision: D26137442 fbshipit-source-id: 649be596b67a01c6d1f4be341aad65f1099b74a1
-
- 29 Jan, 2021 3 commits
-
-
Robin Cheng authored
Reviewed By: igorsugak Differential Revision: D26142316 fbshipit-source-id: 6ee85228e58f5068ee14154d02ad07f731c039ec
-
Andrew McFague authored
Summary: This introduces the concept of a *concurrent* version of `folly::lazy` that stems from our own needs for use lazily instantiated class variables in a multi-threaded environment. Reviewed By: ot, praihan, luciang Differential Revision: D25958581 fbshipit-source-id: 6b85402708fe9ca31b4d93607cf92f23d6a3edb5
-
Dan Melnic authored
Summary: Fix broken build Reviewed By: ispeters, Orvid Differential Revision: D26138456 fbshipit-source-id: 8f46b268ecaf923e507db6706af7840095a151f7
-
- 28 Jan, 2021 3 commits
-
-
Lee Howes authored
Summary: DefaultCPUExecutor is the same as InlineExecutor, but hidden to avoid instantiating it to allow filtering on type, primarily in coro::task. Reviewed By: mpark, terrelln Differential Revision: D26077566 fbshipit-source-id: 06704134f2446727cbb9f093df0b1954b46d2e49
-
Pranjal Raihan authored
Summary: The current data storage API code assumes that the MicroLock is 4-byte aligned and that the lock lives in the lowest byte of `word()`. This assumption is incorrect (see added test). We should instead rely on `baseShift()`. This API is only used for `folly::compact_once_flag` which is new so low chance something broke. Reviewed By: andriigrynenko, davidtgoldblatt Differential Revision: D26091484 fbshipit-source-id: c6e6e9aa7a963cada16e0ef7783fcc6bf6d2aed6
-
Pranjal Raihan authored
Summary: Even though `folly::MicroLock` is 1 byte, `detail::Futex<>` (aka `std::atomic<uint32_t>`) operates on 4 bytes. So 3 bytes are accessed but not used in any way. So we need to disable memory sanitizer. Reviewed By: andriigrynenko Differential Revision: D26082888 fbshipit-source-id: fe585b60c96f48c02df69d182bd75a8eccde2a42
-