- 31 May, 2018 10 commits
-
-
Nathan Bronson authored
Reviewed By: yfeldblum Differential Revision: D8208046 fbshipit-source-id: 58ae8a1df7fedd7bb8ec63bcb51c82ec7fb3c9e8
-
Maged Michael authored
Summary: Avoid spin-waiting for threads that may be descheduled by making steps that used to require waiting for action by a specific thread wait-free. The changed steps are: - Allocating and linking the next segment - Advancing tail to the next segment - Advancing head to the next segment For SPSC, the consumer still must wait for the producer to advance tail before it advances head. Reviewed By: djwatson Differential Revision: D8124279 fbshipit-source-id: 4dc9b2c1f333a71e7283175e0f9c4ab2eaeb7549
-
Lee Howes authored
Make Future<T>::delayed complete on correct executor 2/n: Apply codemod future delayed to delayed unsafe Summary: Overall plan to modify Future<T>::delayed to complete on the same executor as the input future. 2/n: Codemod Future<T>::delayed to Future<T> delayedUnsafe. Name-only change, no behaviour. Reviewed By: yfeldblum Differential Revision: D8217994 fbshipit-source-id: e20f861c2545f08a177b78e1dba643b267146e94
-
Sven Over authored
Summary: We do not want implicit copies of `KeepAlive`, because they may be accidental and they impose an overhead. However, making a copy by calling `folly::getKeepAliveToken(keep_alive.get())` does not look very nice. Also, in case that `keep_alive` is a dummy, it makes an unnecessary call to `Executor::keepAliveAcquire`, which will return false but cannot be inlined usually because it's a virtual function. This diff adds a `copy() const` method which returns a copy of the `KeepAlive` object. It only calls `Executor::keepAliveAcquire` if the original object is not a dummy. Reviewed By: yfeldblum, andriigrynenko Differential Revision: D8203839 fbshipit-source-id: bb595d3836405bd84e55c4214ac19127b1e0e42a
-
Sven Over authored
Summary: This diff adds a simple unit test, verifying that construction of a `KeepAlive` object (either from `Executor*` or move construction) calls `keepAliveAcquire` and `keepAliveRelease` the correct number of times. Reviewed By: elsteveogrande Differential Revision: D8203944 fbshipit-source-id: 297beeaab99c55d7284ca06edd5e6b9023e27619
-
Andre Pinto authored
Summary: Somehow gcc49 as used in travis-ci is having a hard time deciding which constructor to call in `folly/executors/test/ThreadPoolExecutorTest.cpp:721`. It can't decide between `folly/executors/CPUThreadPoolExecutor.h:69` and `folly/executors/CPUThreadPoolExecutor.h:83`. All this diff does is give it a hint about which constructor it should use. Reviewed By: yfeldblum Differential Revision: D8219425 fbshipit-source-id: d92b08efc8bad795ce4a6775efd1e0512aaa6bb5
-
Yedidya Feldblum authored
Summary: [Folly] Cut Futures private invocability helpers, which can be replaced with invoke_result, is_invocable, etc. Reviewed By: marshallcline Differential Revision: D8087901 fbshipit-source-id: 17282d77aaff61350d1e7f1b0c363c25db8fb5b1
-
Yedidya Feldblum authored
Summary: [Folly] No longer allow continuations taking non-const lvalue-ref, since that is not really necessary - callers can get all the same results using continuations taking non-const rvalue-ref instead. Reviewed By: Orvid Differential Revision: D8166011 fbshipit-source-id: 468d049c6034339f3caf1a82fbc8c755ec2f51e6
-
Lee Howes authored
Summary: Overall plan to modify Future<T>::delayed to complete on the same executor as the input future. 1/n: Adds Future<T>::delayedUnsafe that is identical to Future<T>::delayed but acts as a codemod target. Reviewed By: marshallcline Differential Revision: D8209451 fbshipit-source-id: ee9c1184de2847e142516b315140fcc6d43948c5
-
Andre Pinto authored
Summary: `libfollylogging_example` is failing to link because it cannot find the definition of `folly::default_domain`. This diff adds Hazptr.cpp to the build script, which actually defines `folly::default_domain`. Reviewed By: yfeldblum Differential Revision: D8217299 fbshipit-source-id: 5fb36ef2f160cf45e93c2fc4098d58d384390e5d
-
- 30 May, 2018 10 commits
-
-
Maged Michael authored
Summary: - Use the hazptr library under folly/synchronization. - Use hazptr_obj_base_linked to manage counted links. Reviewed By: djwatson Differential Revision: D7674822 fbshipit-source-id: a87ece5dd1c7670677486af59988af8518abaf92
-
Yedidya Feldblum authored
Summary: CodeMod: `future-then-continuation-lvalue-ref`. ``` buck run mode/opt foundation/clangr:clangr_coordinator -- run foundation/clang/codemods:future-then-continuation-lvalue-ref --dev -p 7 --num-workers=200 ``` There is no need to support continuations taking non-const lvalue-ref params; callers can get exactly the same semantics with non-const rvalue-ref params instead. Thsi codemod preserves semantics. Many of these cases could do just as well taking by value, but this codemod preserves semantics. Reviewed By: Orvid Differential Revision: D8166008 fbshipit-source-id: 84b635cccce24b6485ffb5b24b98f10422b9a517
-
Lee Howes authored
Summary: Original commit changeset: adcd387e237d Reviewed By: mzlee Differential Revision: D8204982 fbshipit-source-id: 2c66f58ccf41dc70f55b3ecffc6e197c23c4f959
-
Maged Michael authored
Summary: Fix typos Reviewed By: Tingzhe Differential Revision: D8160938 fbshipit-source-id: f4eaf496a33b7d2b6266a8424850640028660331
-
Dave Watson authored
Summary: As title. These methods look like they never protected observers_ list, and relied on the user not calling addObserver or removeObserver concurrently. I don't see any downsides to taking a write lock here, these methods aren't called often. Reviewed By: davidtgoldblatt Differential Revision: D8187184 fbshipit-source-id: dd20b809e851cc14a05aca3bc9722e0a9236665f
-
Dave Watson authored
Summary: Causing perf issues. Users must add explicitly to tests or other use cases. Differential Revision: D8162835 fbshipit-source-id: 7095064209ced870768552307675dc1ebbf68bdc
-
Dave Watson authored
Summary: Add correct memory barrier to thread timeout / add path. This seems like the fastest way to maintain safety here. We could use a read-biased rw lock instead, but that would mean taking a heavy memory barrier in add() if we do have to add a thread. Reviewed By: davidtgoldblatt Differential Revision: D8161950 fbshipit-source-id: af2bd3a601ced9bb04a8206696e7a998c75f6369
-
Lee Howes authored
Summary: Future::delayed could complete on Future::sleep's executor. Ensure instead that it completes on the future's executor. Reviewed By: yfeldblum Differential Revision: D8052038 fbshipit-source-id: adcd387e237dbd724d5f9deb5c80d1418987482d
-
Lee Howes authored
Summary: Make onTimeout call thenError which maintains the executor rather than onError which does not. Reviewed By: yfeldblum Differential Revision: D8051906 fbshipit-source-id: 41ca5f657a441ff8eaacdfab6d4cfb45d5e5f0c2
-
Andrii Grynenko authored
Summary: This enables using Executor adaptors (e.g. SerialExecutor) with futures. Reviewed By: yfeldblum Differential Revision: D8198893 fbshipit-source-id: 48c59b618bd2bbad4277b7f0b0f0b19347266813
-
- 29 May, 2018 6 commits
-
-
Lee Howes authored
Summary: Futures documentation was drifting out of date. The documentation index also had broken links to Futures and a core readme. This change adds basic futures documentation in the docs tree and removed the README.md in the futures tree. Reviewed By: marshallcline Differential Revision: D7937360 fbshipit-source-id: 120610cca21db5a8b38199a5098551f10bb85251
-
Lee Howes authored
Consistency with folly::SemiFuture continuations 5/n: make deferError use the same exception unpacking machinery as thenError Summary: Step 5 in adding full set of r-value-qualified unambiguous continuation methods to folly::Future for consistency with folly::SemiFuture. * Back point explicit exceptions election to deferError. Reviewed By: marshallcline Differential Revision: D8124828 fbshipit-source-id: 123b1cf460d2df4c8f359eff7329d34fbd8e0a9b
-
Dave Watson authored
Summary: Add cleanup benchmark Reviewed By: magedm Differential Revision: D8162617 fbshipit-source-id: 5ef729913db889f999c8bb051c4291e748854000
-
Maged Michael authored
Summary: Add a try_peek() member function valid only if SingleConsumer==true that returns folly::Optional<const T*> which (if has_value() is true) contains a pointer to the first element in the queue. Reviewed By: djwatson Differential Revision: D7969290 fbshipit-source-id: 3e15138f6c6523adce4da4cd99b74e0a83cd24d7
-
Dave Watson authored
Summary: Use folly::test::Barrier in benchmark instead of spin-waiting. Benchmarks are more consistent now, and perf output is useful instead of showing a bunch of spinning. Also remove the DSched stuff from bench(), we don't want to benchmark DSched. Reviewed By: davidtgoldblatt Differential Revision: D8162600 fbshipit-source-id: 52a1218e7fc2b87f0926dbc29c13bf0c9478e804
-
Dave Watson authored
Summary: Split barrier to separate file so it can be used in other tests. Reviewed By: magedm Differential Revision: D8162586 fbshipit-source-id: c3a239fe6fdb3f895557e7b93a5a960b9e871f0c
-
- 28 May, 2018 9 commits
-
-
Yedidya Feldblum authored
Summary: [Folly] Avoid errnoeous deprecation warning in `F14BasicSet`. The deprecation warning is emitted for instantiations like `F14FastSet<std::string>`. The warning is triggered by looking for move-constructibility of the mapped type for maps or `void` for sets, but `void` is not move-constructible. There are a variety of techniques to solve this, and the smallest change is to use `lift_unit_t` in the right place. `Unit` is move-constructible where `void` is not. Reviewed By: nbronson Differential Revision: D8178045 fbshipit-source-id: 1ca06e84b4ed7acd415901afcbe80663513063ea
-
Yedidya Feldblum authored
Summary: [Folly] Cut extra template instantiations from `Unit` traits - namely, `std::conditional` and `std::is_same`. The behavior can be done directly, while each extra template instantiations imposes some small compile-time cost. Reviewed By: Orvid Differential Revision: D8178033 fbshipit-source-id: 22ba5ae810e2bca616e7db332c1f635e2520f3a7
-
Lee Howes authored
Summary: Step 4 in adding full set of r-value-qualified unambiguous continuation methods to folly::Future for consistency with folly::SemiFuture. * Adds r-value qualified thenError that just call onError internally but in a more type safe obvious way. * Makes exception selection explicit to avoid exception_wrapper exception-type ambiguity in continuations. Reviewed By: yfeldblum Differential Revision: D7971326 fbshipit-source-id: 8aa94161abb629d94ee8da6fb0a4bca991cf24e4
-
Lee Howes authored
Summary: Step 3 in adding full set of r-value-qualified unambiguous continuation methods to folly::Future for consistency with folly::SemiFuture. * Undefs function-scoped defines to avoid leaking. Reviewed By: yfeldblum Differential Revision: D7997136 fbshipit-source-id: 4eb188bc55134da8349e984e9eb85466d7b0042c
-
Orvid King authored
Summary: MSVC was failing to resolve `AllocTraits` within this specific context. Reviewed By: yfeldblum Differential Revision: D8179354 fbshipit-source-id: 236094f704bc89ec81236e9a67054e2081590cf6
-
Orvid King authored
Summary: There are quite a few things in Folly that are not compatible with C++11. Closes: https://github.com/facebook/folly/issues/851 Reviewed By: yfeldblum Differential Revision: D8179239 fbshipit-source-id: b4ce23b98311a7c5ac15c3b7c9787f568535c950
-
Lee Howes authored
Summary: Step 2 in adding full set of r-value-qualified unambiguous continuation methods to folly::Future for consistency with folly::SemiFuture. * Adds r-value qualified thenTry which directly forwards to then, but has compile-time restrictions on the continuations that can be passed to avoid ambiguity. Reviewed By: yfeldblum Differential Revision: D7944820 fbshipit-source-id: 55ee09455703bb73168694175e884b053caff426
-
Lee Howes authored
Summary: [Folly] Invoke SemiFutures defer-continuations with the same cvref as passed. for example, if passed as const&&, invoke as const&&, and if passed as volatile&, invoke as volatile&. This brings a little more consistency to the library. Reviewed By: yfeldblum Differential Revision: D8125144 fbshipit-source-id: f2cda643aaae40e0293d5d79608541771642ce06
-
Lee Howes authored
Summary: Step 1 in adding full set of r-value-qualified unambiguous continuation methods to folly::Future for consistency with folly::SemiFuture. * Add r-value qualified Future<T>::thenValue. * Make callableResult structs consistently named so they work for Future and SemiFuture. * Correct call behaviour for consistency with invokeCallbackReturningFutureAsRvalue test. Reviewed By: yfeldblum Differential Revision: D7944603 fbshipit-source-id: 081383a91749310472a8106289671cffa6139691
-
- 27 May, 2018 1 commit
-
-
Orvid King authored
Summary: This gets Folly working with the zstd package provided by vcpkg. Reviewed By: yfeldblum Differential Revision: D8176531 fbshipit-source-id: 05fdd5915a677a862791cfcc5587f7a396fb4c51
-
- 26 May, 2018 4 commits
-
-
Orvid King authored
Summary: We are changing `folly::collectAll` to return `SemiFuture` rather than `Future` and this is needed as an interim step. After all calls to `collectAll` are changed to `collectAllSemiFuture`, we'll be renaming it back to `collectAll`. Reviewed By: yfeldblum Differential Revision: D8157548 fbshipit-source-id: 27b768ac7ff0d6572bde57f01601045a1fd5d5e5
-
Marshall Cline authored
Summary: Discussion in D7923362 included validity & behavior of `wait()` vs. fulfillment and `wait()` vs. `then()`. 18 test-cases: 8 cases with `.wait(...)` and fulfillment: - Future vs. SemiFuture - wait() vs. wait(dur) - fulfilled before wait(...) call vs. during wait(...) call 10 cases with `.wait(...)` and `.then(...)`: - 4 wait() cases: {Future vs. SemiFuture} that gets fulfilled {prior to, during} the wait() call. - 6 wait(dur) cases: {Future vs. SemiFuture} that gets fulfilled {prior to, during, after} the wait(dur) call. Reviewed By: yfeldblum Differential Revision: D8048426 fbshipit-source-id: c79cc337706f08f8fb9c6057a114723320a90820
-
Nathan Bronson authored
Summary: This diff adds recurring tests of F14's ability to use stateful functors with no default constructor. This is a test-only diff. Reviewed By: yfeldblum Differential Revision: D8170593 fbshipit-source-id: 6ce8c7751ce32ed69b60c6884b5deb7e6378a5d1
-
rdhabalia authored
Summary: We are using facebook::proxygen to build Http-utility on top of it. One of the main server-connector class `Proxygen::HTTPConnector` requires `folly::HHWheelTimer` to perform timer stuff inside it. Now, `folly::HHWheelTimer` is a very large object and we would like to avoid `folly::HHWheelTimer` creation for every new `Proxygen::HTTPConnector` therefore, we are thinking to reuse `EventBase::timer()` that creates one timer per EventBase (application creates it 1 per io thread). But `EventBase::timer()` creates timer with default-time and caller can not modify it. Because of that other dependent component can't use it and proxygen gives below error: ``` F0522 23:50:19.629158 7775 WheelTimerInstance.cpp:71] Check failed: defaultTimeoutMS_.count() >= 0 (-1 vs. 0) *** Check failure stack trace: *** @ 0x7f5e6ce26e6d (unknown) @ 0x7f5e6ce28ced (unknown) @ 0x7f5e6ce26a5c (unknown) @ 0x7f5e6ce2963e (unknown) @ 0x7f5e6de8c1ad proxygen::WheelTimerInstance::scheduleTimeout() @ 0x7f5e6de7c059 proxygen::HTTPTransaction::HTTPTransaction() @ 0x7f5e6deacff1 ... @ 0x7f5e6deaa23a proxygen::HTTPSession::createTransaction() @ 0x4f7f93 proxygen::HTTPUpstreamSession::newTransaction() @ 0x4ad9a4 Sherpa::HttpSession::sendRequest() @ 0x4aee08 Sherpa::HttpSession::connectSuccess() @ 0x4f5c69 proxygen::HTTPConnector::connectSuccess() @ 0x7f5e6d47e414 folly::AsyncSocket::handleConnect() @ 0x7f5e6d48769d folly::AsyncSocket::handleWrite() @ 0x7f5e6d47a05c folly::AsyncSocket::ioReady() ``` - add `setDefaultTimeout()` method into timer so, application can configure it. - No functional change but it facilitates application to configure defaultTimeout after `folly::HHWheelTimer` is created. Closes https://github.com/facebook/folly/pull/850 Reviewed By: djwatson Differential Revision: D8123617 Pulled By: yfeldblum fbshipit-source-id: 4dd9b19506bea380239200b6207ac05a40a0686c
-