- 23 May, 2018 2 commits
-
-
Matthieu Martin authored
Summary: A simpler manual executor that can be executed by a python thread, and release the GIL while waiting. Reviewed By: andriigrynenko Differential Revision: D8087779 fbshipit-source-id: a75ecbda3804a53f1b705aa04546b74368738b7b
-
Matthieu Martin authored
Summary: AsyncioLoopController is totally generic. We were able, after all, to put all the python specifics in the Executor, and keep it simple. I'm using it with ManualExecutor succesfully in my project. Reviewed By: andriigrynenko Differential Revision: D8085689 fbshipit-source-id: 007f65a72e41aa98113b7ee4e188719d9bc20340
-
- 22 May, 2018 5 commits
-
-
Petr Lapukhov authored
Summary: We use proxy to wrap the server side of TTLS connection, thus we can safely disable TTLS option on server side. This helps with cases where people create server socket, then pass the FD to child, and that FD is a UNIX socket because of TTLS. Reviewed By: djwatson Differential Revision: D8096569 fbshipit-source-id: 657c3cee3a9df49cbb80fad771a897264d5277f4
-
Murali Vilayannur authored
Summary: Diff exposes a more convenient constructor interface in CPUThreadPoolExecutor that is analogous to the existing constructor interface with the only exception that it takes a pair of min and max number of threads that drives the executor. Reviewed By: djwatson Differential Revision: D8088545 fbshipit-source-id: 3ee92070335267948332ef75d67817d25436262f
-
Ivan Mylyanyk authored
Summary: `std::vector<bool>` is a bit specific ([1], [2] and [3]), so element access doesn't return bool, but `std::vector<bool>::reference` instead. Folly did not know how to cast it to bool. [1]: http://en.cppreference.com/w/cpp/container/vector_bool [2]: http://en.cppreference.com/w/cpp/container/vector_bool/reference [3]: https://en.wikipedia.org/w/index.php?title=Sequence_container_(C%2B%2B)&oldid=767869909#Specialization_for_bool Reviewed By: yfeldblum, ot Differential Revision: D7986013 fbshipit-source-id: 01c1350b3f6815e9da4ce6305f25e4b9b1ca9d6d
-
Andrii Grynenko authored
Summary: This is blocking D8022229 Reviewed By: yfeldblum Differential Revision: D8086230 fbshipit-source-id: 3d6f2c32190b405b9089c9d41378827e8cb2bb80
-
Yedidya Feldblum authored
Summary: [Folly] Update some outdated fields in Futures Core test - the callback type and the interrupt lock type have been changed. Reviewed By: Orvid Differential Revision: D8084531 fbshipit-source-id: 3991360052c9309b531b7be64ef8e92d5ce6200c
-
- 21 May, 2018 1 commit
-
-
Yedidya Feldblum authored
Summary: [Folly] Introduce makePromiseContract, for producing a paired promise-and-semi-future or a paired promise-and-future, depending on which overload is invoked. It is not ideal that a future is gotten from a promise, but only once. Rather, it is ideal that they be created together. C++17 code may use structured bindings: ```lang=c++ auto [p, f] = makePromiseContract(); // promise with semi-future auto [p, f] = makePromiseContract(&e); // promise with future, given executor e ``` Reviewed By: LeeHowes Differential Revision: D7984050 fbshipit-source-id: 52ee5624fde7c48aa0e81243564ad067c6c6919f
-
- 20 May, 2018 2 commits
-
-
Orvid King authored
Summary: This will allow incremental migration of `collectAll` to `collectAllSemiFuture`. Once everything is migrated to `collectAllSemiFuture`, `collectAll` will change to be the exact same as `collectAllSemiFuture`, then all uses will be moved back to `collectAll` and `collectAllSemiFuture` will be removed. Reviewed By: yfeldblum Differential Revision: D8015664 fbshipit-source-id: 07a154dc733fd7e1e003f4c103355e7b5d1ad1b5
-
Maged Michael authored
Summary: Add hazptr_domain* member to hazptr_rec that never changes. Remove hazptr_domain* member from hazptr_holder. The primary optimization is reducing the sizes of hazptr_holder and hazptr_array from two pointers to one pointer per owned hazard pointer. A secondary advantage is allowing swap of an individual holder in hazptr_array with a hazptr_holder object or an element of another hazptr_array under the conditions: both are either empty or nonempty and if nonempty both hazptrs belong to the same domain. Performance effects on hazptr_holder: + Half the steps for empty construction, move and swap. + One less step in typical construction. - Indirect instead of direct read of pointer to domain, but indirection is likely to be a cache hit if the hazptr was used recently. Measurements: - Faster construction/destruction of hazptr_array<3>. 7.5 ns. instead of 8.5 ns. - No regression in other microbenchmarks. Reviewed By: davidtgoldblatt Differential Revision: D8010395 fbshipit-source-id: 01ffd26f675e57547b1506b777c79d18052ccc65
-
- 19 May, 2018 6 commits
-
-
Maged Michael authored
hazptr: Link counting. Protecting descendants of protected objects. Mutable and immutable links. Automatic retirement. Summary: The class hazptr_obj_linked includes all the reference counting and automatic retirement mechanisms. It supports: - Mutable and Immutable links. - Certain and uncertain removal. With certain removal users call retire. With uncertain users call unlink when an object is unlinked. The library determines automatically when to retire such object. - E.g., UnboundedQueue uses immutable links with certain removal. - E.g., ConcurrentHashMap uses mutable links with uncertain removal. Reviewed By: djwatson Differential Revision: D7674658 fbshipit-source-id: 948f5c3690367deaa0e2023a2def3bed2c22b9f0
-
Andrii Grynenko authored
Summary: This makes keep-alive join also happen if stop/join are called directly. Reviewed By: yfeldblum Differential Revision: D8060479 fbshipit-source-id: 1d1c0cdbcaac2e439aee9ad14f00fa7e4fda2339
-
Andrii Grynenko authored
Summary: This is useful to fix legacy tests that use loop(), as keep-alive tokens are used more widely. (Note: this ignores all push blocking failures!) Reviewed By: yfeldblum Differential Revision: D8065959 fbshipit-source-id: 2e7a27f538ac9d36eeea7ba3a882633a193141d1
-
Yedidya Feldblum authored
Summary: [Folly] Split Futures exceptions by `Promise` vs `Future`. * Move `Promise` exceptions into the `Promise` header. * Move `Future` exceptions into the `Future` header. * Split `NoState` into `PromiseInvalid` and `FutureInvalid`. * Remove the newly-empty exceptions header. Reviewed By: andriigrynenko Differential Revision: D7966499 fbshipit-source-id: 2dc6d2a941493979ebf47b3e70e5cf6a6fbd33cf
-
Murali Vilayannur authored
Summary: Trivial change to allow different services to turn this flag off at runtime Reviewed By: djwatson Differential Revision: D8060492 fbshipit-source-id: 8a62065ee1913fc67b6ae6983d03625849e139b3
-
Yedidya Feldblum authored
Summary: [Folly] `like`, `like_t`, `forward_like`, as per p0847r0. See: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0847r0.html. Reviewed By: nbronson Differential Revision: D8040722 fbshipit-source-id: 4c8a64037ec7447c8afa7b086c36db0f836f66f2
-
- 18 May, 2018 8 commits
-
-
Dave Watson authored
Summary: Make erase(iterator) return an iterator, like std containers. Reviewed By: yfeldblum Differential Revision: D8047159 fbshipit-source-id: 3cc94782a7afca0bf9fedefdc7296b9395ca9859
-
Maged Michael authored
Summary: This fix aims to prevent cases (pointed out by David Goldblatt) where cleanup returns while a concurrent slower bulk_reclaim has not completely reclaimed objects that are supposed to be reclaimed before the return from reclaim. This fix uses an atomic count of the number of ongoing bulk_reclaim-s. Cleanup returns only if it observes that that count is zero. Reviewed By: djwatson Differential Revision: D7586325 fbshipit-source-id: 341af641d20a7a07206c7238ea0356a9eabdbab5
-
Marshall Cline authored
Summary: Remove Armed: it added an avoidable extra state transition, plus avoidable semantic complexity in the behavior/contract of setResult() & setCallback(), i.e., if either of those transitioned to Armed, that thread may or may not be the one that made the transition to Done with the possibly-synchronous call to the callback. After this change there is only one transition after Only* - to Done, and the new contract/behavior of setResult/setCallback is still asynchronous (the caller cannot know which thread will call the callback) but at least has only one asynchrony instead of two (the thread that transitions to Done is always the thread that calls doCallback()). Reviewed By: yfeldblum Differential Revision: D8049396 fbshipit-source-id: 89a1e40ab8c09db4c8ab0ac3a1fd2cc5e092830d
-
Maged Michael authored
Summary: Use synchronization/hazptr instead of experimental/hazptr Reviewed By: djwatson Differential Revision: D7565384 fbshipit-source-id: 26790eec80f344cb4b227672e6d51d97c9170dee
-
Andre Pinto authored
Reviewed By: Orvid Differential Revision: D8053447 fbshipit-source-id: 4550e4fabffb7e6be7d7927292aed2b33c10dee5
-
Orvid King authored
Summary: Kerberos has issues with include order on Windows, so give it it's own portability header to force the correct include order and undefine the mess it `#define`'s. Reviewed By: yfeldblum Differential Revision: D8050238 fbshipit-source-id: 6c718f8f0db9f039734bead5f90cd289ea1dfd78
-
Andrii Grynenko authored
Summary: This is blocking D8022229 (Note: this ignores all push blocking failures!) Reviewed By: yfeldblum Differential Revision: D8038878 fbshipit-source-id: 4b5f085b86f065df0612a132ec26c3d4980edbd1
-
Orvid King authored
Summary: Because it defines `HANDLE_FLAG_INHERIT` (Note: this ignores all push blocking failures!) Reviewed By: yfeldblum Differential Revision: D8050035 fbshipit-source-id: a67d19aa7882f312273e0761123d6827fe07bd81
-
- 17 May, 2018 3 commits
-
-
Marshall Cline authored
Summary: Avoid overhead of std::function (virtual fn, possible malloc) when the interrupt msg reaches the core before the interrupt handler (the former in future.raise(), the latter in promise.setInterruptHandler()). Reviewed By: yfeldblum Differential Revision: D7994756 fbshipit-source-id: 58827e7ac320b6585f1a1c3df08932bbe38f91ee
-
Dave Watson authored
Summary: For greater clarity, return a BlockingQueueResult struct from add instead of a raw bool Reviewed By: yfeldblum, magedm Differential Revision: D7709300 fbshipit-source-id: 36fce6b1006ccf29985f431515c1c61deb84b6d3
-
Maged Michael authored
Summary: For history of the experimental version see folly/experimental/hazptr Added: - Support for deterministic schedule testing. Fixes: - Eliminates performance pathological cases for hazptr_array and hazptr_local construction when a thread cache can only partially satisfy the needed number of hazptr_holder-s. - try_protect sets ptr to the value read from src on success. Otherwise, ptr may be used by the client code when it is invalid. Code improvements including: - Using separate files for different components. - Eliminated all macro definitions except one. - Simplified thread local structures. Reviewed By: davidtgoldblatt Differential Revision: D7565357 fbshipit-source-id: fb00fad7395148e66d6231a374b5b717574ed270
-
- 16 May, 2018 8 commits
-
-
Marshall Cline authored
Summary: Core::detachFuture() & detachPromise() are called from dtors; make them 'noexcept' Reviewed By: yfeldblum Differential Revision: D7995163 fbshipit-source-id: 5c15e0516be2559a2ce1d283dc6fa75c2f506cd8
-
Phil Willoughby authored
Summary: Duplicate of line 22. Since the included header contains #pragma once it was doing nothing. If it hadn't been a duplicate it would have been a problem because it was included within either a `namespace folly` or `namespace std...` block. Reviewed By: yfeldblum Differential Revision: D8031245 fbshipit-source-id: 4486859a11939a61d634c5603243785e6ec5a36c
-
Chip Turner authored
Summary: This method ensures the singleton exists with less overhead than calling `try_get` or `try_get_fast`. Reviewed By: yfeldblum Differential Revision: D8020292 fbshipit-source-id: 470ebea9fdb07e46a469c820f9149d6fc5af5d2f
-
Dave Watson authored
Summary: There is a race with stop() and timeouts. stop() may race with a thread timeout, and then block indefinitely on joinStoppedThreads(), waiting to join the already joined timed-out thread. To fix, just put everything behind a write lock, simplifying the code at the same time. Reviewed By: davidtgoldblatt Differential Revision: D7971779 fbshipit-source-id: eb4a898ca266ddda0f95033950ac041d1cc812ba
-
Yang Chi authored
Summary: A lot of functions in AsyncUDPSocket just use a CHECK for fd_ and fail hard if ths socket hasn't bound to a fd. This adds an API for user to actually find out if socket has bound without crash. (Note: this ignores all push blocking failures!) Reviewed By: siyengar Differential Revision: D8026035 fbshipit-source-id: fc7bf9c1d6d7f045cd4dba94e3278d20d80de887
-
Adam Simpkins authored
Summary: `folly/test/DynamicTest.cpp` contained a duplicate definition of `dynamic::print_as_pseudo_json()`. This caused link errors due if this test was linked against `json.cpp`. Part of the problem here is that the `//folly:dynamic` library is somewhat of a lie: the `dynamic::print_as_pseudo_json()` method is provided by the `//folly:json` library rather than by `//folly:dynamic`. This violates assumptions made by autodeps. Ultimately the right thing to do might be to combine `//folly:json` and `//folly:dynamic` into a single rule. Reviewed By: yangchi Differential Revision: D8020841 fbshipit-source-id: e563611309c122680a5fc69c3f0da1ad5d4337b0
-
Dan Melnic authored
Fix "multiple definition of 'folly::dynamic::print_as_pseudo_json(std::ostream&) const'" linker error Summary: Fix "multiple definition of 'folly::dynamic::print_as_pseudo_json(std::ostream&) const'" linker error Reviewed By: yfeldblum Differential Revision: D8016705 fbshipit-source-id: 7ef8306852afd8e765f22e657f44fbe67c66f6f5
-
Yang Zhang authored
Summary: constexpr_clamp_cast<> provides sane numeric conversions from float point numbers to integral numbers, and between different types of integral numbers. When doing clamp_cast<DstT>(value), if `value` is in valid range of DstT, it will give correct result in DstT, equal to `value`. If `value` is outside the representable range of DstT, it will be clamped to MAX or MIN in DstT. Float NaNs are converted to 0 in integral type. For comparison, static_cast<> will return garbage results when SrcT is float point number and it's outside DstT valid range. This is because float-cast-overflow is undefined behavior. Reviewed By: yfeldblum Differential Revision: D7716736 fbshipit-source-id: 5899e4b20cdd997d0c7b121ddaababbc8c748301
-
- 15 May, 2018 5 commits
-
-
Orvid King authored
Summary: As per title. Reviewed By: yfeldblum Differential Revision: D8014022 fbshipit-source-id: df24a839804e9bb6c063994adbbde3544535b66c
-
Yedidya Feldblum authored
Summary: [Folly] Use `throw_exception` in `folly/futures/`, replacing the one-off throw functions. Reviewed By: Orvid Differential Revision: D7965947 fbshipit-source-id: ed5855aaccf4aa07ecb40489db9fa92090df9016
-
Yedidya Feldblum authored
Summary: [Folly] Let `Future` handle throwing `FutureNotReady`, since it is logically the thing that knows about specific exceptions in its contract. Reviewed By: LeeHowes Differential Revision: D7964855 fbshipit-source-id: 49f3220a6a41ebe87f577814c0940e00497092c0
-
Adam Simpkins authored
Summary: Update the folly::Init code to define a `--logging` command line flag, and call `folly::initLoggingOrDie()` with the value of this command line during initialization. This is similar to the existing code that initializes the glog library. (Programs can use both glog and folly logging together in the same program, and I expect that many programs will do so as parts get converted to folly::logging and parts remain using glog.) Reviewed By: yfeldblum Differential Revision: D7827344 fbshipit-source-id: 8aa239fbad43bc0b551cbe40cad7b92fa97fcdde
-
Teng Qin authored
Summary: Currently, when we add or delete a `RequestData` instance to `RequestContext` for the first time, we do not call the `RequestData`'s `onSet` or `onUnset` callback. This means if the `RequestData` is doing tracking-related work, it may miss the beginning or the request until the first switch of `RequestContext` has happend, and in the end as well. This Diff fixes the issue by calling `onSet` and `onUnset` when adding or deleting. Reviewed By: anakryiko Differential Revision: D7978623 fbshipit-source-id: a524286371f890598bc773e957ef609e90086cea
-