- 13 Sep, 2016 1 commit
-
-
Andrii Grynenko authored
Reviewed By: yfeldblum Differential Revision: D3853494 fbshipit-source-id: 23f5cadcb55a9307fb2a825fe4c53a03c5978d12
-
- 12 Sep, 2016 1 commit
-
-
Giuseppe Ottaviano authored
Summary: Temporarily overriding `NDEBUG` can have unexpected side-effects depending on the implementation of `<assert.h>`. Better use an explicit macro for `assert()` that we can explicitly disable. Reviewed By: Gownta Differential Revision: D3850717 fbshipit-source-id: b1e7fce89ab4120b0224e9c6bf668d983b3d2d31
-
- 10 Sep, 2016 3 commits
-
-
Christopher Dykes authored
Summary: Switch all of the uses of `<gtest/gtest.h>` to `<folly/portability/GTest.h>`. This is painful but necessary to get the tests to compile nicely under MSVC. Reviewed By: yfeldblum Differential Revision: D3837300 fbshipit-source-id: 7ae43a5d5ba94c8c24fa23a485f18546416e7191
-
Christopher Dykes authored
Summary: Switch all of the uses of <gmock/gmock.h> to <folly/portability/GMock.h>. This is painful but necessary to get the tests to compile nicely under MSVC. Reviewed By: yfeldblum Differential Revision: D3837529 fbshipit-source-id: 7221dfea8f2a880919690b5b0601ca91642991ae
-
Christopher Dykes authored
Summary: Both the gtest and gmock headers include `<io.h>` on Windows, which conflicts with how the portability headers include it, so a specific include order is required before either of those headers can be included. As that's brittle and messy, create a pair of portability headers for them instead, so that those can be included instead. This only adds the headers. The switch to using them will be done in a later pair of diffs. Reviewed By: mzlee Differential Revision: D3837221 fbshipit-source-id: 82a273485cdd4536f1153d958c171bfe3ec32e0b
-
- 09 Sep, 2016 5 commits
-
-
Eric Niebler authored
Summary: Move fbstring_core and basic_fbstring member functions from in-situ to out-of-class inlines and refactor for readability. Remove superfluous dependence on scope_guard. Reviewed By: ot, luciang Differential Revision: D3795250 fbshipit-source-id: f6edca25d4771181faff9e0a4339bbaffd71a370
-
Yedidya Feldblum authored
Summary: [Folly] Nomenclature in `Synchronized` - prefer `read` to `shared`. `folly::Synchronized` is a higher-level abstraction, so it will use higher-level nomenclature than will lower-level tools like `std::mutex` and `folly::LockTraits`. `shared` describes the lock state, and is used in the C++ libraries. `read` describes the class of operations that calling code is permitted to perform. Reviewed By: simpkins Differential Revision: D3840060 fbshipit-source-id: 4b23eaa391cb59d1eca2bfacf72db89d3c7c591e
-
Daniel Sommermann authored
Summary: I'm working with a parser that requires a certain number of contiguous bytes to be able to make forward progress. I'm also using IOBufQueue to receive data from an AsyncReader::ReadCallback with pre/postallocate. So, I need to call gather() to ensure that the queue's front IOBuf has the right number of contiguous bytes available. Reviewed By: djwatson Differential Revision: D3838079 fbshipit-source-id: 9f1ec5c86895eb1b2b109f9f145ca42d2dbba4c6
-
Anirudh Ramachandran authored
Summary: As in title Reviewed By: siyengar Differential Revision: D3794648 fbshipit-source-id: f0b7052f34ecce65cf4e21d546d08c7a6b0a8ee3
-
Michael Lee authored
Summary: Switch from #ifdef to #if so the configuration can define the macro to 0 Reviewed By: yfeldblum, Orvid Differential Revision: D3838748 fbshipit-source-id: e287b07f0fdfdc86c882538e96f2078795b85bfd
-
- 08 Sep, 2016 6 commits
-
-
Denis Samoylov authored
Summary: current log entries ("E0906 AsyncSSLSocket.cpp:117] TCP connect failed: AsyncSocketException: connect failed, type = Socket not open, errno = 111 (Connection refused)") are not very helpful to debug due lack of details and can spam logs of application that uses async library without ability to disable logging Reviewed By: djwatson Differential Revision: D3825048 fbshipit-source-id: 1c97f14e1ea3f1b276d04bb12483d42372a0d186
-
Maged Michael authored
Summary: This diff allows queues to start with small capacity and expand as needed up to the specified capacity. The main additions and changes: - Extra template parameter `Dynamic` that enables dynamic expansion (`default 'false'). - `ClosedArray` type. - Extra members: -- `dstate_`: a packed 64 bit unsigned int that contains a seqlock (which implicitly indicates the number of expansions and the lowest ticket for the current `dslots_/dcapacity_/dstride_` configuration. -- `dcapacity_`: current dynamic capacity. -- `dslots_`: current dynamic slots array. (in anonymous union with `slots_`) -- `dstride_`: current dynamic stride. (in anonymous union with `stride_`) -- `closed_` a logarithmic-sized array of ClosedArray to hold information about earlier smaller queue arrays for use by lagging consumers. Design sketch: - Reallocate a new larger array on expansion - Expansion uses a seqlock. The common case critical path includes a seqlock read-only section. - Lagging consumers and lagging blocking producers use a logarithmic-sized array for info about closed arrays - Tickets are adjusted by an offset (to accounts for the tickets associated with earlier closed arrays) in order to calculate appropriate index and turn. - The synching of `pushTicket_` with the ticket offset packed in `dstate_` is tricky. `pushTicket_` is accessed outside `dstate_`'s seqlock. Reviewed By: djwatson Differential Revision: D3462592 fbshipit-source-id: d442a7694190cca3c33753409ffac941d7463f83
-
Andrii Grynenko authored
Reviewed By: djwatson Differential Revision: D3832835 fbshipit-source-id: b5cabc00758fd80b314424e4224458e2d50ddb5c
-
Zonr Chang authored
Summary: This fixes build with Clang. Closes https://github.com/facebook/folly/pull/470 Differential Revision: D3834865 Pulled By: nbronson fbshipit-source-id: 02c1ca192c6b6af2cc0a8fdaa0a854510cb0bca4
-
Tom Jackson authored
Summary: This previously allowed `get_ref_default(map, 4, []{ return 6; })`, even though this would form a reference to a temporary, then **use that invalid reference**. Reviewed By: yfeldblum Differential Revision: D3802707 fbshipit-source-id: 384d965f69c9d7b6bd3f011c8eff7fe55be7023a
-
Christopher Dykes authored
Summary: MSVC doesn't support the aligment attribute being after the field name. Reviewed By: yfeldblum Differential Revision: D3832314 fbshipit-source-id: 6a56db245e01922ede6b9b93eb1c8aecc835e2bf
-
- 07 Sep, 2016 2 commits
-
-
Nathan Bronson authored
Summary: C++'s integer division performs truncation, but it is fairly common that people actually want to round up. There are actually four rounding modes that make some sense: toward negative infinity (floor), toward positive infinity (ceil), toward zero (truncation), and away from zero (?). It is pretty common that code that wants ceil actually writes (a + b - 1) / b, which doesn't work at all for negative values (and has a potential overflow issue). This diff adds 4 templated functions for performing integer division: divFloor, divCeil, divTrunc, and divRoundAway. They are not subject to unnecessary internal underflow or overflow, and they work correctly across their entire input domain. I did a bit of benchmarking across x86_64, arm64, and 32-bit ARM. Only 32-bit ARM was different. That's not surprising since it doesn't have an integer division instruction, and the function that implements integer division doesn't produce the remainder for free. On 32-bit ARM a branchful version that doesn't need the modulus is used. Reviewed By: yfeldblum Differential Revision: D3806743 fbshipit-source-id: c14c56717e96f135321920e64acbfe9dcb1fe039
-
Maged Michael authored
Summary: Changed DSched interface for managing auxiliary functions to allow separate auxiliary functions for single actions (applicable to the next shared access by a specific thread) and repeating actions (applicable to all subsequent shared accesses). [Note: I have a dependent diff that depends on both this diff and the diff for dynamic MPMCQueue (/D3462592). I don't think I can submit a diff that depends on multiple diffs that haven't landed yet. So, I'll wait until this one lands.] Reviewed By: djwatson Differential Revision: D3792669 fbshipit-source-id: 52654fffda2dc905b19ff91f4459f15da11f7735
-
- 06 Sep, 2016 3 commits
-
-
Christopher Dykes authored
Summary: The previous version assumed that `RegionSize` would always be the full size of the allocation done by `VirtualAlloc`. However, `RegionSize` actually only includes the following pages that have the same attributes, so, if you change the access permissions via `mprotect`, the `RegionSize` would exclude that region, which is not what was intended. This instead stores the length and a dummy magic value after the end of the requested allocation. Reviewed By: yfeldblum Differential Revision: D3812949 fbshipit-source-id: 53bbbcc371accbed08adaffa82fc082ec44f316f
-
Chip Turner authored
Summary: We were doing an unnecessary and wasteful string conversion in the SocketAddr codepath. This eliminates it. I also noticed we had an off-by-one in the "convert string to char buffer" code path, so I added a test to confirm the bug and fixed it. Reviewed By: yfeldblum, meyering Differential Revision: D3817959 fbshipit-source-id: 51fed8331ab23c0888a3d1f9e0cc9cea5ea8329b
-
Christopher Dykes authored
Summary: This gets the socket portability layer functional enough that most of the socket tests are passing, the few that are left are depending on specific error messages. This also switches all of the additional overloads for some of the socket functions to forward to a single implementation, to make adjustments to these functions easier in the future. (most of the functions already needed adjustments and would have had to change regardless) Reviewed By: yfeldblum Differential Revision: D3814011 fbshipit-source-id: c6793ee74a91d9e164775a2d52c96f54b28b9f24
-
- 02 Sep, 2016 1 commit
-
-
Philip Pronin authored
Summary: This code compiles and is causing stack overflow at runtime: ``` using F = folly::Function<void()>; void foo(F); F bar; auto baz = [bar = std::move(bar)] { foo(std::move(bar)); }; baz(); ``` The bug there is that `baz` is missing `mutable` keyword, so when constructing argument for `foo`, `F(const F&&)` is called, which is selecting `template <typename Fun> F(Fun&&)` (where `Fun = F const`) and we end up in an infinite `F<Fun>(Fun&&) <-> F<Fun>(Fun&&, SmallTag|HeapTag)` cycle. This diff transforms this easy-to-make-bug into compile-time error. Reviewed By: yfeldblum Differential Revision: D3810269 fbshipit-source-id: f80a18ab02bd0715d692cf67c3c8943f557c2982
-
- 01 Sep, 2016 3 commits
-
-
Chip Turner authored
Summary: itshappening Need to override unit test failures after repeated landing failures unrelated to the change. Reviewed By: yfeldblum Differential Revision: D3803301 fbshipit-source-id: b6581e3d2ff6baba57eb0f61b890a61107118bf7
-
Phil Willoughby authored
Summary: Now builds correctly Reviewed By: meyering Differential Revision: D3763879 fbshipit-source-id: e272fbcc28a74fcf36b63a0135534c5063a7c4ee
-
Eric Niebler authored
Summary: Fix code that is transitively including ScopeGuard.h via FBString.h. Reviewed By: yfeldblum Differential Revision: D3801328 fbshipit-source-id: 7e1dc37cd6dd3aa691dd1baf31385d3a8c51eed0
-
- 31 Aug, 2016 8 commits
-
-
Andrii Grynenko authored
Summary: Make sure exception is propagated to caller (especially when Observer is just created). Reviewed By: yfeldblum Differential Revision: D3798991 fbshipit-source-id: cee8452cfd40dcfbaf0e2ae2c2ee628af0362c6e
-
Colin Ni authored
Summary: Minor changes. Simplified the memory-handling explanation; also fixed some grammar issues and re-worded some confusing paragraphs. (I suggest reading the edited and unedited versions separately.) Closes https://github.com/facebook/folly/pull/459 Reviewed By: simpkins Differential Revision: D3779296 Pulled By: Orvid fbshipit-source-id: 24b086cbd0b67e4c592731aeec6a7ffc14ff0319
-
Adam Simpkins authored
Summary: Update TimeseriesHistogram::rate(int level) to have a configurable return type, similar to the rate(TimeType start, TimeType end) function, as well as the avg() functions. I believe it was simply an oversight initially that this version of rate did not have a configurable return type. Since rate() and avg() are template methods, their full definitions should really be available in TimeseriesHistogram.h rather than TimeseriesHistogram-defs.h. This also fixes that problem. Most of the logic in these functions isn't actually dependent on the return type, so that was split out into separate non-template helper functions that are still in TimeseriesHistogram-defs.h Reviewed By: yfeldblum Differential Revision: D3776017 fbshipit-source-id: 7deebf5b9ea1be143b5d772a15246706cb0cae80
-
Zonr Chang authored
Summary: Default namespace for GFlags has been changed from "google" to "gflags". See: https://github.com/gflags/gflags/commit/d9d06b9. Closes https://github.com/facebook/folly/pull/466 Reviewed By: yfeldblum Differential Revision: D3787144 Pulled By: Orvid fbshipit-source-id: db7bcaf4e2bcd46b022a48b17b50ef155570f296
-
Philip Pronin authored
Summary: Move ThreadLocal object destruction to occur under the lock to avoid races. This causes a few cascading changes - the Tag lock needs to be a recursive_mutex so constructing a new object while destroying another st. Also, forking requires a new mutex to avoid deadlocking on accessing a recursive_mutex across a fork() Reviewed By: andriigrynenko Differential Revision: D3755446 fbshipit-source-id: f1f1f92175eb39e77aaa2add6915e5c9bb68d0fb
-
Naizhi Li authored
Summary: Currently reset does not actually reset it. This change make sure it does the job. Reviewed By: yfeldblum Differential Revision: D3788869 fbshipit-source-id: 771a641e31bb3cf307e5bebb979b81a3d3feea55
-
Gabriel Grise authored
Summary: Adding two methods to export the parameters used to generate the key material (key_block). These parameter can be used to decrypt a TLS session from a packet capture. Reviewed By: anirudhvr Differential Revision: D3687099 fbshipit-source-id: 04137f34dd32c387a1b7aec04b3ed6066f123a8e
-
Michael Lee authored
Summary: This should not affect correctness, but it means SharedMutex would need to share the variable across threads. Reviewed By: yfeldblum Differential Revision: D3621227 fbshipit-source-id: dc1baa7c47cd2d459cd0ef89451bcd7fd4d553aa
-
- 30 Aug, 2016 5 commits
-
-
Zonr Chang authored
Summary: 10e9cd3e set up SCOPE_EXIT to join threads (wait for them to exit) on exceptions. However, it is also called on normal exit. Remove the original code at the end for joining threads. This fixes EventBaseTest regression. Closes https://github.com/facebook/folly/pull/468 Reviewed By: yfeldblum Differential Revision: D3792977 Pulled By: Orvid fbshipit-source-id: e4b12202ae3e35fd942ad2ca1d8d405cf1a28f68
-
Zonr Chang authored
Summary: Closes https://github.com/facebook/folly/pull/467 Reviewed By: yfeldblum Differential Revision: D3787151 Pulled By: Orvid fbshipit-source-id: e255c9daea9917082f684e52e27984770c9f08b1
-
Zonr Chang authored
Summary: Closes https://github.com/facebook/folly/pull/465 Reviewed By: yfeldblum Differential Revision: D3787146 Pulled By: Orvid fbshipit-source-id: 17433a256338bd107eec41e69af3eef58de3339b
-
Bruno Goncalves authored
Summary: For some systems like my Fedora 23 is missing -lcrypto library to be together with -lssl The following error ocurr running 'make check': avoid undefined reference to symbol 'EVP_DigestInit_ex Closes https://github.com/facebook/folly/pull/428 Reviewed By: yfeldblum Differential Revision: D3787160 Pulled By: Orvid fbshipit-source-id: 8ff69d00c9c752d0a005d2a5e8d68e65347cc43b
-
Anand Mazumdar authored
Summary: Optional::value() returns a temporary object when the object is an rvalue. This is different in semantics then what boost::optional/std::optional do. The decision to make the copy or not should be up to the user and not the library. Consider an example: ``` void F(Optional<T> &&opt) { T&& t = std::move(opt).get(); // I know `opt` is alive in this scope, I should be able to keep a rvalue ref to the internals } // if we were to return a `T`, that would actually return a new temporary. ``` ``` void G(T&& t); G(std::move(opt).get()); // This could have surprising behavior too ! ``` This change modified the return type to be `T&&` and also introduces an extra overload for `const T&&`. Also, deleted two test-cases that assume the lifetime to be extended. This is a breaking change but this brings folly::Optional on parity with other siblings. Closes https://github.com/facebook/folly/pull/353 Reviewed By: ddrcoder Differential Revision: D3714962 Pulled By: yfeldblum fbshipit-source-id: 1794d51590062db4ad02fc8688cb28a06712c076
-
- 29 Aug, 2016 2 commits
-
-
Dan Schatzberg authored
Summary: Move ThreadLocal object destruction to occur under the lock to avoid races. This causes a few cascading changes - the Tag lock needs to be a recursive_mutex so constructing a new object while destroying another st. Also, forking requires a new mutex to avoid deadlocking on accessing a recursive_mutex across a fork() Reviewed By: andriigrynenko Differential Revision: D3755446 fbshipit-source-id: bb4c4f29bab98d763490df29b460066f124303e0
-
Andrii Grynenko authored
Reviewed By: mzlee Differential Revision: D3780312 fbshipit-source-id: c42c8f0a06b82520ee1b46f105a2a85ad524c442
-