folly.git
9 years agoMove FingerprintBenchmark to Folly
Rameshkumar Shihora [Wed, 21 Oct 2015 18:31:52 +0000 (11:31 -0700)]
Move FingerprintBenchmark to Folly

Summary: FingerprintBenchmark was in an internal directory before, but it belongs alongside the Fingerprint code.

Reviewed By: yfeldblum

Differential Revision: D2534646

fb-gh-sync-id: d8ded3a5a9d33f60e9674ea71dc87a2d8d19a51b

9 years agoImprove folly::Singleton try_get perf and bring back raw get benchmark
Andrii Grynenko [Wed, 21 Oct 2015 02:34:57 +0000 (19:34 -0700)]
Improve folly::Singleton try_get perf and bring back raw get benchmark

Reviewed By: elsteveogrande

Differential Revision: D2517522

fb-gh-sync-id: eab11d17ce5db94e09aa733b6067e44d36be6345

9 years agoAdd support for in-place creation of NotificationQueue::Consumer
Petr Lapukhov [Tue, 20 Oct 2015 22:30:55 +0000 (15:30 -0700)]
Add support for in-place creation of NotificationQueue::Consumer

Summary: as title, this comes handy when multiple consumers are needed
within the same class.

Reviewed By: has

Differential Revision: D2530249

fb-gh-sync-id: 942761782a100b2d3fe54d94a7c1b0e03b95a847

9 years agoAdd getIPv6For6To4 to IPAddressV4
Emil Hesslow [Tue, 20 Oct 2015 21:52:07 +0000 (14:52 -0700)]
Add getIPv6For6To4 to IPAddressV4

Summary: - I added this in PHP ( D2534138 ) so add it here too
- This is my first folly diff so I probably done something wrong :)

Reviewed By: yfeldblum

Differential Revision: D2549168

fb-gh-sync-id: 5e6a80097be01fb54342e0c9da5b69465f695f80

9 years agoBring zstd support into folly/io/Compression.h
Jon Maltiel Swenson [Tue, 20 Oct 2015 03:18:30 +0000 (20:18 -0700)]
Bring zstd support into folly/io/Compression.h

Summary: Bring zstd support into folly/io/Compression.h

Reviewed By: chipturner

Differential Revision: D2551026

fb-gh-sync-id: 7c13338d45efb0fc19f0b44015c7e62d945a483b

9 years agoRemove boost dependency from folly/ProducerConsumerQueue.h
Bruno Goncalves [Sat, 17 Oct 2015 02:03:22 +0000 (19:03 -0700)]
Remove boost dependency from folly/ProducerConsumerQueue.h

Summary: Boost is great, but c++11 incorporate some of their stuffs, and classes like ProducerConsumerQueue don't need it anymore.
Closes https://github.com/facebook/folly/pull/321

Reviewed By: fredemmott, yfeldblum

Differential Revision: D2519081

fb-gh-sync-id: b138a5af4662d1e7ef5e0823cf4001880ee02456

9 years agoChange NotificationQueue assert -> CHECK
Ranjeeth Dasineni [Sat, 17 Oct 2015 00:22:49 +0000 (17:22 -0700)]
Change NotificationQueue assert -> CHECK

Summary: If the eventFd goes bad, NotificationQueue consumers can cause their event loop to spin indefinitely.  If libevent gets POLLERR on the fd, it calls handlerReady, which triggers a read.  The read will fail, but the callback is never uninstalled.  I'm not sure it would be easy to recover gracefully from this, so crash hard instead.

Reviewed By: yfeldblum, pgriess

Differential Revision: D2550270

fb-gh-sync-id: c9575fbda778b3625da6d9db6b0542b8263f230a

9 years agoCommiting missing header file change from D2408773
Kyle Nekritz [Fri, 16 Oct 2015 22:57:07 +0000 (15:57 -0700)]
Commiting missing header file change from D2408773

Summary: AsyncSSLSocket.h change was not synced from D2408773 /
f7176051f816980a985beeb9b8a907dddd0dc0e3.

Test Plan: file matches D2408773

Reviewers:

CC:

Task ID: #

Blame Rev:

9 years agofix initializer order bug in MemoryIdler
Nathan Bronson [Fri, 16 Oct 2015 21:27:11 +0000 (14:27 -0700)]
fix initializer order bug in MemoryIdler

Summary: Make sure page size has been fetched from the operating system
before it is used in asserts.

Reviewed By: meyering

Differential Revision: D2551368

fb-gh-sync-id: d3735571e2a45f613bbbd7e0f158a755d36b376c

9 years agoAvoid the ODR issue with ThreadLocalDetail's kInvalid
Yedidya Feldblum [Fri, 16 Oct 2015 19:46:00 +0000 (12:46 -0700)]
Avoid the ODR issue with ThreadLocalDetail's kInvalid

Summary: [Folly] Avoid the ODR issue with `ThreadLocalDetail`'s `kInvalid`.

The problem is that it is a `static constexpr` class member, so pull it out of the class.

Reviewed By: bmaurer

Differential Revision: D2549272

fb-gh-sync-id: 28a73e73b9cf9f21bee2bba2125513c02ef56ce2

9 years agoReverting D2503151 to unbreak buck build
Madhu Ramanathan [Fri, 16 Oct 2015 18:07:24 +0000 (11:07 -0700)]
Reverting D2503151 to unbreak buck build

Summary: This breaks buck build. Reverting till the fix is in to unblock build pipeline.

Reviewed By: jmswen

Differential Revision: D2550685

fb-gh-sync-id: 7623e6c7fcaad70d7d207ec10a59f7381c72cebc

9 years agoBring ZSTD support into folly/io/Compression.h
Jon Maltiel Swenson [Fri, 16 Oct 2015 16:42:43 +0000 (09:42 -0700)]
Bring ZSTD support into folly/io/Compression.h

Summary: Bring ZSTD support into folly/io/Compression.h

Reviewed By: chipturner

Differential Revision: D2503151

fb-gh-sync-id: c1450cecc8197db654b7a080a63753caa666f686

9 years agoMissed some derivation from boost::noncopyable after deleting the .hpp header.
Aaron Roth [Fri, 16 Oct 2015 14:54:02 +0000 (07:54 -0700)]
Missed some derivation from boost::noncopyable after deleting the .hpp header.

Summary: There remained some derivations from boost::noncopyable in inner classes after boost/noncopyable.hpp was deleted in D2459355. Get rid of these two.

Reviewed By: meyering

Differential Revision: D2485930

fb-gh-sync-id: 89546490b15fa4279debf4b9cabcf48d3dc336bb

9 years agoAdd connection event callback to AsyncServerSocket
Mohammad Husain [Fri, 16 Oct 2015 04:13:25 +0000 (21:13 -0700)]
Add connection event callback to AsyncServerSocket

Summary: Adding a callback to AsyncServerSocket to get notified of client connection events. This can be used for example to record stats about these events.

Reviewed By: @afrind

Differential Revision: D2544776

fb-gh-sync-id: 20d22cfc939c5b937abec2b600c10b7228923ff3

9 years agofolly: Symbolizer: don't colorize TERM="dumb" or TERM="" or TERM-undefined TTYs
Lucian Grijincu [Fri, 16 Oct 2015 03:04:34 +0000 (20:04 -0700)]
folly: Symbolizer: don't colorize TERM="dumb" or TERM="" or TERM-undefined TTYs

Reviewed By: @dcolascione

Differential Revision: D2548486

fb-gh-sync-id: 6e2d7e84598eb5b05aba7a262b7c53532337dbe3

9 years agofolly: Symbolizer: don't allocate from function which is supposed to be signal safe
Lucian Grijincu [Fri, 16 Oct 2015 02:17:30 +0000 (19:17 -0700)]
folly: Symbolizer: don't allocate from function which is supposed to be signal safe

Reviewed By: @philippv, @dcolascione

Differential Revision: D2548023

fb-gh-sync-id: d2b0571d5db03e38ed17a5de6a13d2194a05b2b9

9 years agoSpecialize and implement setThreadName only on some platforms
Yedidya Feldblum [Fri, 16 Oct 2015 01:55:27 +0000 (18:55 -0700)]
Specialize and implement setThreadName only on some platforms

Summary: [Folly] Specialize and implement `setThreadName` only on some platforms.

With this technique, we can compile setThreadName and programs that call it on MSVC/Windows and on other platforms that don't have the underlying pthread call.

This is an alternative to: https://reviews.facebook.net/D46317.

Reviewed By: @nbronson

Differential Revision: D2535593

fb-gh-sync-id: 09d26f53e3fe69b49326b5b6492a7d59f86db2e8

9 years agoundefined reference to 'folly::threadlocal_detail::StaticMeta<void>::EntryID::kInvalid'
Jody Ho [Fri, 16 Oct 2015 01:51:01 +0000 (18:51 -0700)]
undefined reference to 'folly::threadlocal_detail::StaticMeta<void>::EntryID::kInvalid'

Summary: In some cases, folly::threadlocal_detail::StaticMeta<void>::EntryID::kInvalid
is odr-used, a definition at the namespace scope is required even though it has
been initialized with a brace-or-equal initializer.

See http://en.cppreference.com/w/cpp/language/static

Reviewed By: @yfeldblum

Differential Revision: D2548668

fb-gh-sync-id: 9cd6d7b2f37d1481d1adbf4f0a2d9e66631efd15

9 years agoAdd framework for switching certs based on signature_algorithms TLS extension.
Kyle Nekritz [Thu, 15 Oct 2015 15:19:48 +0000 (08:19 -0700)]
Add framework for switching certs based on signature_algorithms TLS extension.

Summary: Added support for switching SSLContexts based on the signature_algorithms
extension.
This diff does not currently include any logic for determining which certs use
SHA1 or not.

Some thoughts:
- This is a little scary since it defaults to SHA1 (assuming the client can't support
SHA256 if we don't see SHA256 specifically in the hello extension). We need to
be 100% sure that all clients that are going to reject SHA1 are sending this,
and that we identify it correctly.
- We should add logging to see when we think a client needs SHA1, when we
actually give SHA1, etc. I'm not sure what the best way to do this is with our
logging infrastructure.
- This is not setup to serve any SHA1 certs to SHA256 supporting clients.

Reviewed By: @siyengar

Differential Revision: D2408773

fb-gh-sync-id: 48ad9cdfaae25e144c0964b9bfb1c342b137ffca

9 years agoFix Build: under GCC 4.9 + ASAN, RangeSse42.cpp fails to build
Yedidya Feldblum [Thu, 15 Oct 2015 05:39:59 +0000 (22:39 -0700)]
Fix Build: under GCC 4.9 + ASAN, RangeSse42.cpp fails to build

Summary: [Folly] Fix Build: under GCC 4.9 + ASAN, `RangeSse42.cpp` fails to build.

Reviewed By: @ldemailly, @meyering

Differential Revision: D2544284

fb-gh-sync-id: fd50f8b326252291ad3a5d9fe956e7e647ad0133

9 years agoAdd handshake and connect times
Subodh Iyengar [Thu, 15 Oct 2015 05:03:26 +0000 (22:03 -0700)]
Add handshake and connect times

Summary: Add api to get time taken to establish
connections and to complete handshake
for clients using AsyncSocket directly.

Reviewed By: @afrind

Differential Revision: D2435074

fb-gh-sync-id: f44c336e62c426736eb5b3d88dd57a18572382e8

9 years agoEphemeral ciphers in false start list
Subodh Iyengar [Thu, 15 Oct 2015 05:01:55 +0000 (22:01 -0700)]
Ephemeral ciphers in false start list

Summary: Only include ephemeral ciphers in false start list.

Reviewed By: @​mzlee

Differential Revision: D2429447

fb-gh-sync-id: 430d287a93249ff72b9ebe7db3bc283bb0712600

9 years agoFix Build: address some maybe-uninitialized warnings in folly/test/StringTest.cpp
Yedidya Feldblum [Wed, 14 Oct 2015 05:08:20 +0000 (22:08 -0700)]
Fix Build: address some maybe-uninitialized warnings in folly/test/StringTest.cpp

Summary: [Folly] Fix Build: address some `maybe-uninitialized` warnings in `folly/test/StringTest.cpp`.

Reviewed By: @meyering

Differential Revision: D2535743

fb-gh-sync-id: fa6a071436d22169e2be69cec1abae19851657d2

9 years agoFix Build: address some maybe-uninitialized warnings in folly/io/async/EventBase.cpp
Yedidya Feldblum [Wed, 14 Oct 2015 00:28:55 +0000 (17:28 -0700)]
Fix Build: address some maybe-uninitialized warnings in folly/io/async/EventBase.cpp

Summary: [Folly] Fix Build: address some `maybe-uninitialized` warnings in `folly/io/async/EventBase.cpp`.

Reviewed By: @meyering

Differential Revision: D2535753

fb-gh-sync-id: ff32f6957675d3b6d0267b1a59fb0c3aac4fe86e

9 years agoHandle less_than_impl and greater_than_impl under MSVC
Orvid King [Tue, 13 Oct 2015 22:26:52 +0000 (15:26 -0700)]
Handle less_than_impl and greater_than_impl under MSVC

Summary: MSVC chokes on the template constraints of these functions, so use a single implementation that will be const-folded by the optimizer instead.
Closes https://github.com/facebook/folly/pull/281

Reviewed By: @yfeldblum

Differential Revision: D2419069

fb-gh-sync-id: c9ad3d135430f8265bbc90391b45d9295d6de362

9 years ago(folly) have Try::moveFromTry take an lvalue
Hans Fugal [Tue, 13 Oct 2015 21:20:21 +0000 (14:20 -0700)]
(folly) have Try::moveFromTry take an lvalue

Summary: This is a case of having to say what you're doing twice, and it's unnecessary.
This change should not break anything as calling `std::move(lvalue)` where an
lvalue reference is expected will just be superfluous.

Reviewed By: @jsedgwick

Differential Revision: D2534944

fb-gh-sync-id: fdcd168f369d95b0f28abe23b401b4321f51fc36

9 years agonever destroy LifoSem's wait node pool
Nathan Bronson [Tue, 13 Oct 2015 21:07:12 +0000 (14:07 -0700)]
never destroy LifoSem's wait node pool

Summary: Some LifoSem-s survive late into program execution, which means
that destroying the IndexedMemPool that holds LifoSem waiter nodes can
cause crashes during program shutdown.

Reviewed By: @chadparry

Differential Revision: D2536597

fb-gh-sync-id: c9b3b73b61f2b8bdcb00d03f4c6d3daf24b267c3

9 years agoDon't do memory operations in chunks on MSVC
Orvid King [Tue, 13 Oct 2015 18:58:18 +0000 (11:58 -0700)]
Don't do memory operations in chunks on MSVC

Summary: Because, especially with the way that munmap is implemented in my windows port, this is a very bad idea. Plus, it's completely unnecessary on Windows.
Closes https://github.com/facebook/folly/pull/265

Reviewed By: @yfeldblum

Differential Revision: D2283757

fb-gh-sync-id: 831c8aaad9bd5ad0fe091ea1e006814774d8a27c

9 years agoGetter to know if the socket is accepting new connections
Mohammad Husain [Tue, 13 Oct 2015 17:21:40 +0000 (10:21 -0700)]
Getter to know if the socket is accepting new connections

Reviewed By: @yfeldblum

Differential Revision: D2534627

fb-gh-sync-id: 2934911b69542b4befa8dc03ec3cadb4a148496d

9 years agoFix ThreadLocal on android/apple
Ben Maurer [Tue, 13 Oct 2015 16:08:02 +0000 (09:08 -0700)]
Fix ThreadLocal on android/apple

Summary: The thread local destructor was assuming that the singleton object
had been created.

Reviewed By: @​yangchi

Differential Revision: D2536166

fb-gh-sync-id: b0c08e0990f684c0afae054ee17c62a924260f2b

9 years agofolly: NotificationQueue: fix headers
Lucian Grijincu [Tue, 13 Oct 2015 09:49:16 +0000 (02:49 -0700)]
folly: NotificationQueue: fix headers

Summary: Include headers for all std:: stuff used in the header + getpid().

```
       #include <sys/types.h>
       #include <unistd.h>

       pid_t getpid(void);
       pid_t getppid(void);
```

Reviewed By: @yfeldblum

Differential Revision: D2535284

fb-gh-sync-id: b1167e8f382878d27553161b9b569968006355b3

9 years agofolly: fix build with clang 3.6 -Werror
Igor Sugak [Tue, 13 Oct 2015 00:18:50 +0000 (17:18 -0700)]
folly: fix build with clang 3.6 -Werror

Summary: Fix a few `-Wsign-compare` violations

Reviewed By: @meyering

Differential Revision: D2527969

fb-gh-sync-id: 140acbd06eedf2e2a315e1927b331ff5efb20d0f

9 years agofolly: fix clang -Wpessimizing-move
Igor Sugak [Tue, 13 Oct 2015 00:15:20 +0000 (17:15 -0700)]
folly: fix clang -Wpessimizing-move

Summary: Make folly `-Wpessimizing-move` clean:

Common errors:
```lang=bash
folly/io/test/NetworkBenchmark.cpp:71:30: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
    unique_ptr<IOBuf> next = std::move(head->pop());
                             ^
folly/io/IOBufQueue.cpp:153:28: error: moving a temporary object prevents copy elision [-Werror,-Wpessimizing-move]
      appendToChain(head_, std::move(
                           ^
folly/IPAddressV6.cpp:341:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move]
    return std::move(ip);
           ^
folly/IPAddressV6.cpp:341:12: note: remove std::move call here
    return std::move(ip);
           ^~~~~~~~~~  ~
1 error generated.
```

Reviewed By: @fugalh, @meyering

Differential Revision: D2526950

fb-gh-sync-id: 49291a8b49905eb9b2042d004830ff2f599dfbd3

9 years agoadd shutdownWrite to wangle for closing socket write only
Woo Xie [Mon, 12 Oct 2015 22:48:56 +0000 (15:48 -0700)]
add shutdownWrite to wangle for closing socket write only

Summary: current wangle has no way to close socket write side. writeFlags is extended so that wangle/AsyncSocketHandler can distinguish closeNow(), closeWithReset() and shutdownWrite()

Reviewed By: @viswanathgs

Differential Revision: D2522056

fb-gh-sync-id: 60616176d78311a4a09f9761a6ccda01dd502a88

9 years agoSIOF-proof thread local
Ben Maurer [Mon, 12 Oct 2015 21:35:54 +0000 (14:35 -0700)]
SIOF-proof thread local

Summary: Right now ThreadLocal & friends don't operate correctly when used as a
static variable (which is the idiomatic way to use them). The TLS id is
allocated in the static constructor so anybody who uses the ID prior to
first use would use an invalid ID. This makes ThreadLocal unusable for core
code such as per-thread reference counting.

This diff allocates the ID on first use. By making the invalid ID maxint we
avoid adding any extra branches in the fast path. We can then make the
constructor a constexpr meaning that initialization will happen prior to
any code running.

Reviewed By: @meyering

Differential Revision: D2457989

fb-gh-sync-id: 21d0c0d00c638fbbd36148d14d4c891f66f83706

9 years agoMove digits_to into .cpp
Ben Maurer [Mon, 12 Oct 2015 18:06:53 +0000 (11:06 -0700)]
Move digits_to into .cpp

Summary: objdump was showing that the shiftXXX tables are being generated each
time this file is included. For example, HHVM has about 200 of each
of the 4 tables. Since each one is 512 bytes this is 400 KB. I'm not
quite sure why this was happening -- I'd think that the linker would
combine a constant table that was identical.

I think the best thing to do here is just to use extern template. This
way you there's only one copy of the table and you don't have to parse
all of this code in every file

Reviewed By: @yfeldblum

Differential Revision: D2506571

fb-gh-sync-id: b01a522c536a2ff4136340245cacaa33897afefb

9 years agoFix Build: GCC 4.9 has std::make_unique but not __cplusplus >= 201402L
Yedidya Feldblum [Sat, 10 Oct 2015 02:09:42 +0000 (19:09 -0700)]
Fix Build: GCC 4.9 has std::make_unique but not __cplusplus >= 201402L

Summary: [Folly] Fix Build: GCC 4.9 has `std::make_unique` but not `__cplusplus >= 201402L`.

Reviewed By: @igorsugak

Differential Revision: D2528584

fb-gh-sync-id: 9ad0567429698fb1320ad4066ee06add31acbd57

9 years agoMerge pull request #331 from vbuslov/config_fix
Hans Fugal [Fri, 9 Oct 2015 20:15:35 +0000 (13:15 -0700)]
Merge pull request #331 from vbuslov/config_fix

Fix configure script bug on Mac OS X

9 years agoaggregator: fix `doEagerInitVia`
Steve O'Brien [Thu, 8 Oct 2015 22:03:22 +0000 (15:03 -0700)]
aggregator: fix `doEagerInitVia`

Summary: Allow notification upon async eager initialization completion.

Reviewed By: @luciang

Differential Revision: D2518925

fb-gh-sync-id: 95f96da2afa6e5953630dd935d74819521716e5f

9 years agoFix incorrect variable in dynamic examples
软件工程师李飛 [Thu, 8 Oct 2015 20:02:35 +0000 (13:02 -0700)]
Fix incorrect variable in dynamic examples

Summary: Fixes facebook/folly#323

Reviewed By: @JoelMarcey

Differential Revision: D2518882

Pulled By: @fredemmott

fb-gh-sync-id: fc0a07d925945f7d7e1cddb7302c8bf18e0130ab

9 years agoChanged AC_LANG from PROGRAM to SOURCE to prevent double definition of main
Vlad Buslov [Fri, 9 Oct 2015 12:50:09 +0000 (15:50 +0300)]
Changed AC_LANG from PROGRAM to SOURCE to prevent double definition of main

9 years agoUse alloca rather than C99 stack allocated arrays
Orvid King [Thu, 8 Oct 2015 16:52:15 +0000 (09:52 -0700)]
Use alloca rather than C99 stack allocated arrays

Summary: Because MSVC doesn't support the latter.
Closes https://github.com/facebook/folly/pull/271

Reviewed By: @meyering, @fredemmott

Differential Revision: D2283975

fb-gh-sync-id: d021f739ceead9998b8fedbbd95f22ec9fe949b2

9 years agoFixed #317 - unresolved reference to __atomic_is_lock_free
Bruno Goncalves [Wed, 7 Oct 2015 22:02:56 +0000 (15:02 -0700)]
Fixed #317 - unresolved reference to __atomic_is_lock_free

Summary: Tested in:
Distro: Fedora 20 - x86_64
kernel: 3.19
compiler: gcc version 4.8.3
Closes https://github.com/facebook/folly/pull/320

Reviewed By: @sgolemon

Differential Revision: D2519083

fb-gh-sync-id: 07b1437326c393c99feeb6e0764d664d3e22faea

9 years agoSingleton: remove dependency on Future
Steve O'Brien [Wed, 7 Oct 2015 20:11:06 +0000 (13:11 -0700)]
Singleton: remove dependency on Future

Summary: Singletons requires Futures, and Futures indirectly (via HHWheelTimeKeeper) require Singletons.  This breaks the dependency.  It removes a Future-using API which will be replaced with a better alternative.

Reviewed By: @luciang

Differential Revision: D2517807

fb-gh-sync-id: 93df371a74d0f80dc8c55fb0eadd0b688b27b525

9 years agoSingleton: un-inline initialization-time-only methods
Steve O'Brien [Wed, 7 Oct 2015 13:23:01 +0000 (06:23 -0700)]
Singleton: un-inline initialization-time-only methods

Summary: Move some methods which are generally only used during initialization time (registration, eager-init functions) from the header to the .cpp file

Reviewed By: @luciang

Differential Revision: D2513043

fb-gh-sync-id: 58d1f6e0d158d805a12b8d267421927b3cfc6118

9 years agoRemove evil using statements from AsyncSSLSocket.h
Yedidya Feldblum [Wed, 7 Oct 2015 05:22:49 +0000 (22:22 -0700)]
Remove evil using statements from AsyncSSLSocket.h

Summary: [Folly] Remove evil `using` statements from `AsyncSSLSocket.h`.

`using` in headers is frowned upon.

Consider this diff a frown.

Reviewed By: @alandau

Differential Revision: D2509810

fb-gh-sync-id: 4a752b9f4a5be6ac4ca7c498c0168ffad5c35d7f

9 years agofolly: Singleton: update doc to match new Strict vs Relaxed types
Lucian Grijincu [Tue, 6 Oct 2015 19:40:23 +0000 (12:40 -0700)]
folly: Singleton: update doc to match new Strict vs Relaxed types

Summary: smallandbroken

Reviewed By: @fugalh

Differential Revision: D2509021

fb-gh-sync-id: 5e379b82615117df89cbc12943fdbe92511c067e

9 years agoUse attribute(no_sanitize) instead of no_sanitize_address to prevent clang-3.7 from ICE
Adrian Zgorzalek [Tue, 6 Oct 2015 18:19:22 +0000 (11:19 -0700)]
Use attribute(no_sanitize) instead of no_sanitize_address to prevent clang-3.7 from ICE

Summary: Stacktraces and more details can be found in the associated task
http://clang.llvm.org/docs/AttributeReference.html#no-sanitize-clang-no-sanitize seems to be the new hotness to disable sanitizers.

Reviewed By: @yfeldblum

Differential Revision: D2510320

fb-gh-sync-id: 01cce68733509a6f5bcf9dbe3a4af6fc2792a43b

9 years agoAdd byLine tests for empty cases
Tom Jackson [Mon, 5 Oct 2015 22:09:57 +0000 (15:09 -0700)]
Add byLine tests for empty cases

Summary: It works fine, this proves it.

Reviewed By: @yfeldblum, @​jkron

Differential Revision: D2509771

fb-gh-sync-id: 28805a1e1db433d3d9a44b9d33f81e30333e44ab

9 years agoCheck if handshake timeout is set in AsyncSSLSocket::isDetachable().
Kyle Nekritz [Mon, 5 Oct 2015 20:28:42 +0000 (13:28 -0700)]
Check if handshake timeout is set in AsyncSSLSocket::isDetachable().

Summary: If it is, return false.

Reviewed By: @siyengar

Differential Revision: D2503765

fb-gh-sync-id: 36b5e2e8cabc2a5157735637be6ca3414005da81

9 years agoImprove performance of fbstring copy and move ctors on small strings
Giuseppe Ottaviano [Mon, 5 Oct 2015 04:22:12 +0000 (21:22 -0700)]
Improve performance of fbstring copy and move ctors on small strings

Summary: The move constructor of `fbstring` generates a large amount of code, preventing it to be inlined, and it is inefficient for small strings. This diff fixes both problems.

Reviewed By: @yfeldblum

Differential Revision: D2505762

9 years agoFix build
Pavlo Kushnir [Sun, 4 Oct 2015 02:40:46 +0000 (19:40 -0700)]
Fix build

Summary: title

Reviewed By: @yfeldblum

Differential Revision: D2506703

9 years agoFix async readme
Andre Pinto [Sat, 3 Oct 2015 19:47:55 +0000 (12:47 -0700)]
Fix async readme

Summary: AsyncPipe is already open source

Reviewed By: @yfeldblum

Differential Revision: D2506476

9 years agoFix Build: folly/Range.h for build platforms missing SSE42 headers
Yedidya Feldblum [Sat, 3 Oct 2015 06:08:39 +0000 (23:08 -0700)]
Fix Build: folly/Range.h for build platforms missing SSE42 headers

Summary: [Folly] Fix Build: `folly/Range.h` for build platforms missing SSE42 headers.

We make the assumption that if the compiler defines the appropriate symbols indicating SSE42, that the corresponding intrinsics headers are available.

We also remove `Range.cpp` from `Makefile.am`, which we forgot to do in the blamed diff.

Reviewed By: @nbronson

Differential Revision: D2504934

9 years agoAdd "consume all captured output" callback to CaptureFD
Alexey Spiridonov [Sat, 3 Oct 2015 05:30:41 +0000 (22:30 -0700)]
Add "consume all captured output" callback to CaptureFD

Summary: I noticed myself trying to fake this kind of callback for a log-based test I was writing. It seems much nicer to add the callback to `CaptureFD` than roll ugly wrappers around it to do the same thing.

Reviewed By: @yfeldblum

Differential Revision: D2506106

9 years agoConverge folly::make_unique to C++14's std::make_unique
Yedidya Feldblum [Sat, 3 Oct 2015 04:47:38 +0000 (21:47 -0700)]
Converge folly::make_unique to C++14's std::make_unique

Summary: [Folly] Converge `folly::make_unique` to C++14's `std::make_unique`.

The primary use-case of ther deleter variety of `folly::make_unique` is `DelayedDestruction`. Let the classes matching this use-case define their own factories.

Reviewed By: @fugalh

Differential Revision: D2495718

9 years agoSupport SSE-enabled Range functions under Clang
Yedidya Feldblum [Fri, 2 Oct 2015 08:52:56 +0000 (01:52 -0700)]
Support SSE-enabled Range functions under Clang

Summary: [Folly] Support SSE-enabled `Range` functions under Clang.

Basically, we remove GCC-only -isms. In particular, we use only names from the `<emmintrins.h>` and `<smmintrins.h>` headers, instead of the GCC-specific SSE builtins that the original code uses.

But in order to get this to work, we must split out the SSE-enabled functions into their own sources and compile them with the `-msse4.2` flag. There is a way to get around this in GCC by marking individual functions as SEE-enabled, but that technique is not supported in Clang. This is the new `RangeSse42` module.

And in order to do that, we must split out the code that is called by both the original `Range` and the new SSE-enabled functions into yet a third module, `RangeCommon`.

Ahhhhhh, dependencies.

Note that we always compile the SSE-enabled functions, but we only run them on architectures supporting SSE. The original code tests the CPU's capabilities before running any SSE-enabled functions; this change retains that check.

Reviewed By: @nbronson

Differential Revision: D2428983

9 years agofix compiler warnings from gcc-4.9 + -Wunused-variable
Nathan Bronson [Fri, 2 Oct 2015 01:39:47 +0000 (18:39 -0700)]
fix compiler warnings from gcc-4.9 + -Wunused-variable

Summary: This diff fixes the compiler warnings emitted by gcc-4.9's
stricter -Wsigned-comparison check, as well as those revealed by
-Wunused-variable.

Reviewed By: @meyering, @yfeldblum

Differential Revision: D2494514

9 years agothrift-tls: Expose client common name in connection context
Alex Landau [Thu, 1 Oct 2015 22:35:37 +0000 (15:35 -0700)]
thrift-tls: Expose client common name in connection context

Summary: Server can find out client's common name through
Cpp2ConnContext::getPeerCommonName

Reviewed By: @siyengar

Differential Revision: D2469588

9 years agofix build
Alecs King [Thu, 1 Oct 2015 19:19:18 +0000 (12:19 -0700)]
fix build

Summary: fix typo

jenkins and oss build (e.g. travis) failing.

Reviewed By: @pavlo-fb

Differential Revision: D2499462

9 years agoAPIs to determine which end of the socket has closed it
Mohammad Husain [Wed, 30 Sep 2015 21:32:33 +0000 (14:32 -0700)]
APIs to determine which end of the socket has closed it

Reviewed By: @afrind

Differential Revision: D2466921

9 years agofolly Symbolizer: fix destruction-order fiasco problem
Steve O'Brien [Wed, 30 Sep 2015 21:06:22 +0000 (14:06 -0700)]
folly Symbolizer: fix destruction-order fiasco problem

Summary: On a (broken) unit test there is a bad `CHECK` during destruction time.  This triggers an ABRT, goes through the signal handler, and in the process ends up doing a use-after-free.

Moved some globals inside the functions in which they are used (w/ little duplication, as they are used in one place, mostly).

Reviewed By: @luciang, @meyering

Differential Revision: D2494046

9 years agoUpdateableSharedPtr in folly
Dave Watson [Wed, 30 Sep 2015 14:42:24 +0000 (07:42 -0700)]
UpdateableSharedPtr in folly

Summary: This diff adds UpdateableSharedPtr and FastUpdateableSharedPtr classes to folly. They are efficiet RCU-style holders for a shared_ptr. See the comment at the top of UpdateableSharedPtr.h for a more detailed description and benchmark results.

All the added files are copied from logdevice code with (almost) no changes (`logdevice/common/` on branch `origin/logdevice-latest`). We've been using them in logdevice for a few months. D1821723 introduced it.

Reviewed By: @​bmaurer

Differential Revision: D1919702

9 years agoExtract SparseByteSet into its own module
Yedidya Feldblum [Wed, 30 Sep 2015 08:29:59 +0000 (01:29 -0700)]
Extract SparseByteSet into its own module

Summary: [Folly] Extract `SparseByteSet` into its own module.

`SparseByteSet`, formerly `FastByteSet`, is actually a generic, fully standalone class. It does not need to be embedded in `Range.cpp`.

Reviewed By: @​bmaurer

Differential Revision: D2460180

9 years agoadd callback to specify a client next protocol filter
Ranjeeth Dasineni [Wed, 30 Sep 2015 00:57:06 +0000 (17:57 -0700)]
add callback to specify a client next protocol filter

Summary: From the client perspective, we set the list in order of
preference once and call into openssl to do the selection. This adds
a little more flexibility in that client optionally can customize the
selection for each negotiation. added tests for the no-op case and the
customized case. Feel free to suggest improvements.

Reviewed By: @afrind

Differential Revision: D2489142

9 years agoPre-prune iobufs from clone
Subodh Iyengar [Tue, 29 Sep 2015 22:09:36 +0000 (15:09 -0700)]
Pre-prune iobufs from clone

Summary: It's pretty common during parsing protocols with cursors
that there will be empty iobufs along the way.

This changes it so that we prune empty IOBufs in the cloned
output before returning it to the user.

Reviewed By: @djwatson

Differential Revision: D2464488

9 years agoOpen source AsyncPipe
Andre Pinto [Tue, 29 Sep 2015 21:13:54 +0000 (14:13 -0700)]
Open source AsyncPipe

Summary: AsyncPipeReader and AsyncPipeWriter are classes to asynchronously
read and write to pipes.

Reviewed By: @djwatson

Differential Revision: D2479514

9 years agoCodeMod apache::thrift::async::TEventBase to folly::EventBase (remainder)
Yedidya Feldblum [Tue, 29 Sep 2015 19:04:29 +0000 (12:04 -0700)]
CodeMod apache::thrift::async::TEventBase to folly::EventBase (remainder)

Summary: [Thrift] CodeMod `apache::thrift::async::TEventBase` to `folly::EventBase` (remainder).

A few straggler bits left out of D2349828.

Reviewed By: @Gownta

Differential Revision: D2489063

9 years agoBroke build
Ben Maurer [Mon, 28 Sep 2015 18:46:44 +0000 (11:46 -0700)]
Broke build

Summary: sorry

Reviewed By: @​chiunlin

Differential Revision: D2485925

9 years agoEasy SIOF-proofing
Ben Maurer [Mon, 28 Sep 2015 17:58:44 +0000 (10:58 -0700)]
Easy SIOF-proofing

Summary: These classes are likely to be used as static variables and can
easily be constructed with constexpr.

One that we really ought to fix is SpinLock. Sadly we have a bunch of
implementations of it some of which need initialization.

Reviewed By: @meyering

Differential Revision: D2459355

9 years agoSingleton: refine "eager" initialization
Steve O'Brien [Fri, 25 Sep 2015 18:02:46 +0000 (11:02 -0700)]
Singleton: refine "eager" initialization

Summary: * `registrationComplete` has a slightly different interface (uses enums now)
* `void doEagerInit()` method initializes synchronously; `Future<Unit> doEagerInitVia(Executor*)` now available.

Reviewed By: @luciang, @meyering

Differential Revision: D2463464

9 years agoemplace() support for AtomicHashArray/Map
Justin Gibbs [Thu, 24 Sep 2015 16:44:07 +0000 (09:44 -0700)]
emplace() support for AtomicHashArray/Map

Summary: Allow objects that only support in-place construction (no copy/move
constructor) to be stored in AtomicHashMap and AtomicHashArray via the
emplace() method. This uses variadic template parameters and perfect
forwarding to allow the arguments for any valid constructor for the
object to be used during insertion.

Reviewed By: @nbronson

Differential Revision: D2458152

9 years agoA qfind_first_byte_of using a bitset in folly/Range.cpp
Yedidya Feldblum [Wed, 23 Sep 2015 23:10:09 +0000 (16:10 -0700)]
A qfind_first_byte_of using a bitset in folly/Range.cpp

Summary: [Folly] A `qfind_first_byte_of` using a `bitset` in `folly/Range.cpp`.

With additions to the existing benchmark program.

Reviewed By: @nbronson

Differential Revision: D2465890

9 years agorevert D2379210
James Sedgwick [Wed, 23 Sep 2015 21:17:46 +0000 (14:17 -0700)]
revert D2379210

Summary: This broke EventBase tests, which I managed not to run because they're marked as extended for some reason :( I don't have time to take another stab at this at the moment so I'm reverting for now

Reviewed By: @djwatson

Differential Revision: D2467789

9 years agoCpuIdTest.cpp does not need glog
Yedidya Feldblum [Wed, 23 Sep 2015 08:31:53 +0000 (01:31 -0700)]
CpuIdTest.cpp does not need glog

Summary: [Folly] `CpuIdTest.cpp` does not need `glog`.

Reviewed By: @​@​philippv

Differential Revision: D2470503

9 years agoSearch unpadded strings in Range benchmarks
Yedidya Feldblum [Wed, 23 Sep 2015 05:22:20 +0000 (22:22 -0700)]
Search unpadded strings in Range benchmarks

Summary: [Folly] Search unpadded strings in `Range` benchmarks.

`vstr` has padding to adjust alignment. `vstrp` is a view into `vstr` that skips the padding, so that searches start out unaligned.

Before this diff, haystack is 8-byte aligned: `uintptr_t(haystack.begin()) % 8 == 0`. After this diff, it is not.

Reviewed By: @​@​nbronson

Differential Revision: D2468934

9 years agoUse constexpr for folly::dynamic::TypeInfo static fields
Yedidya Feldblum [Wed, 23 Sep 2015 05:06:25 +0000 (22:06 -0700)]
Use constexpr for folly::dynamic::TypeInfo static fields

Summary: [Folly] Use constexpr for folly::dynamic::TypeInfo static fields

These things are compile-time values. So yeah.

Reviewed By: @​@​JoelMarcey

Differential Revision: D2466270

9 years agoFully clean up before each round of benchmarks in RangeFindBenchmark.cpp
Yedidya Feldblum [Tue, 22 Sep 2015 21:03:09 +0000 (14:03 -0700)]
Fully clean up before each round of benchmarks in RangeFindBenchmark.cpp

Summary: [Folly] Fully clean up before each round of benchmarks in `RangeFindBenchmark.cpp`.

The `vstr` and `vstrp` globals need to be cleaned up before each round of benchmarks.

Reviewed By: @​@​nbronson

Differential Revision: D2467254

9 years agoMove definition of strlcpy to outside an #if
Chip Turner [Mon, 21 Sep 2015 22:58:03 +0000 (15:58 -0700)]
Move definition of strlcpy to outside an #if

Summary: Looks like some platforms fail to build (open source, not internal) due to #if conditional.

Reviewed By: @ldemailly

Differential Revision: D2464555

9 years agoFix potential delete behavior of guard
Subodh Iyengar [Mon, 21 Sep 2015 22:38:25 +0000 (15:38 -0700)]
Fix potential delete behavior of guard

Summary: There is a potential double free in destructor guard
if someone calls a method which takes a DG in the destructor
of the DG.

This is potential in the case when someone is holding onto
a DG while calling destroy() on the object.

Reviewed By: @djwatson

Differential Revision: D2463113

9 years agoMake strlcpy available in folly, second attempt
Chip Turner [Mon, 21 Sep 2015 20:42:50 +0000 (13:42 -0700)]
Make strlcpy available in folly, second attempt

Summary: strncpy is bad.  strlcpy is somewhat less bad.  We already had
this function, but let's move it somewhere more reasonable.

This would make sense to live in String.h, but then we have circular
dependencies.  Since String.h includes Demangle.h, though, you get
strlcpy by including it, so this should be okay enough.

Reviewed By: @lbrandy

Differential Revision: D2097590

9 years agomake to<bool> skip range check
Marc Horowitz [Mon, 21 Sep 2015 16:42:44 +0000 (09:42 -0700)]
make to<bool> skip range check

Summary: to<bool>(42) should return true, not throw an exception.

Reviewed By: @yfeldblum

Differential Revision: D2459766

9 years agoUse string for benchmark names to support computed names
Yedidya Feldblum [Sun, 20 Sep 2015 04:51:15 +0000 (21:51 -0700)]
Use string for benchmark names to support computed names

Summary: [Folly] Use string for benchmark names to support computed names.

A benchmark program might call `folly::addBenchmark` with a computed benchmark name without wishing to maintain the lifetime of the string. Support this case.

Reviewed By: @philippv

Differential Revision: D2460621

9 years agoimplement ThreadCachedArena::totalSize()
Philip Pronin [Sat, 19 Sep 2015 06:38:39 +0000 (23:38 -0700)]
implement ThreadCachedArena::totalSize()

Summary: Semantics matches `Arena<>::totalSize()`.

Reviewed By: @luciang, @ot

Differential Revision: D2456388

9 years agomove ThreadWheelTimekeeper out of detail
James Sedgwick [Fri, 18 Sep 2015 22:24:53 +0000 (15:24 -0700)]
move ThreadWheelTimekeeper out of detail

Summary: This can be useful on its own, will use in twagent

Reviewed By: @fugalh

Differential Revision: D2457778

9 years agoSupport MSVC, which does not have VLAs, in folly/io/async/AsyncSocket.cpp
Yedidya Feldblum [Fri, 18 Sep 2015 08:37:13 +0000 (01:37 -0700)]
Support MSVC, which does not have VLAs, in folly/io/async/AsyncSocket.cpp

Summary: [Folly] Support MSVC, which does not have VLAs, in `folly/io/async/AsyncSocket.cpp`.

We use VLAs in compilers that have them, and fixed-size arrays in compilers that do not.

Reviewed By: @JoelMarcey

Differential Revision: D2450689

9 years agofolly Singleton: "eager" option to initialize upfront
Steve O'Brien [Thu, 17 Sep 2015 13:30:23 +0000 (06:30 -0700)]
folly Singleton: "eager" option to initialize upfront

Summary: Instead of the default lazy-loading behavior (still the default) some singletons might need to get initialized at startup time.  This would be for singletons which take a long time for the instance's constructor to run, e.g. expensive initialization by reading some large dataset, talking to an outside service, and so on.

Provides a way for singletons to opt-in to this, and get populated at the time  `registrationComplete()` is called, instead of lazily.

Some notes about the way I implemented here, mainly, why I did this as a "builder-pattern" kind of thing and not some other way.  I could probably be convinced to do otherwise. :)

* Changing the constructor: the constructor's already slightly fiddly with the two optional -- well, one optional construct function, and another optional-but-only-if-construct-provided, destruct function.  Didn't want to pile more into the ctor.
* New superclass called `EagerLoadedSingleton`; just didn't want to add more classes, esp. if it's just to add one more option.
* Method like `void setEagerLoad()` that makes this eager-load; not sure where one would write the `shouldEagerLoad()` call, probably in some central initialization spot in `main()`, but all the maintenance would have to go there.  I like that it's "attached" to the singleton being defined.  (Though you can still do this.)  Bonus #2; the rule that builds the cpp containing "main" doesn't need to import this dependency and the cpp doesn't have to include Singleton just to do this eager-load call, nor the header for the type itself.
* Omitting this altogether and just saying `folly::Singleton<Foo>::get_weak()` to "ping" the singleton and bring into existence: see last point.  Still might need to have the file containing this initialization decorum include/link against Foo, as well as have one place to maintain the list of things to load up-front.

Reviewed By: @meyering

Differential Revision: D2449081

9 years agofolly: clock: remove static globals, replace with meyers singleton
Lucian Grijincu [Thu, 17 Sep 2015 03:20:29 +0000 (20:20 -0700)]
folly: clock: remove static globals, replace with meyers singleton

Reviewed By: @yfeldblum

Differential Revision: D2446000

9 years agoCompatibility: libevent: accessors for struct event
Yedidya Feldblum [Wed, 16 Sep 2015 21:15:19 +0000 (14:15 -0700)]
Compatibility: libevent: accessors for struct event

Summary: [Folly] Compatibility: libevent: accessors for `struct event`.

Some libevent fields in `struct event` moved between `v1.4` and `v2`. Add some accessors which are defined per-libevent-version.

Reviewed By: @JoelMarcey

Differential Revision: D2447537

9 years agofolly: gen: remove static member
Lucian Grijincu [Wed, 16 Sep 2015 18:37:49 +0000 (11:37 -0700)]
folly: gen: remove static member

Summary: there's no need for this static member, but it does get
generated. We're only curious about it's type. Replace with Meyer's
singleton to get the same effect.

Reviewed By: @ddrcoder, @yfeldblum

Differential Revision: D2446131

9 years agofolly: ProgramOptions: avoid static init fiasco by using meyer's singleton
Lucian Grijincu [Wed, 16 Sep 2015 18:32:54 +0000 (11:32 -0700)]
folly: ProgramOptions: avoid static init fiasco by using meyer's singleton

Reviewed By: @elsteveogrande

Differential Revision: D2446056

9 years agoLimit declaration of GroupVarint tables to SSE >= 2
Sara Golemon [Wed, 16 Sep 2015 18:26:52 +0000 (11:26 -0700)]
Limit declaration of GroupVarint tables to SSE >= 2

Summary: __m128i is only available in SSE 2 and later.
We technically only use it in folly/GroupVarint.h for SSE 3+,
but that's due to various other intrinsics and we could
potentially lower the requirement in certain contexts,
so do the right thing in the generated table.
Revisit the uses in folly/GroupVarint.h later.

Reviewed By: @yfeldblum

Differential Revision: D2445798

9 years agouse HHWheelTimer for EventBase::runAfterDelay
James Sedgwick [Wed, 16 Sep 2015 17:38:01 +0000 (10:38 -0700)]
use HHWheelTimer for EventBase::runAfterDelay

Summary: For the perfs - big improvement on one fd per timeout.

Reviewed By: @djwatson, @fugalh

Differential Revision: D2379210

9 years agofolly: io: SSLContext/AsyncSSLSocket: drop global static mutex (siof)
Lucian Grijincu [Wed, 16 Sep 2015 17:05:52 +0000 (10:05 -0700)]
folly: io: SSLContext/AsyncSSLSocket: drop global static mutex (siof)

Reviewed By: @yfeldblum

Differential Revision: D2446538

9 years agofolly: async: fix SIOF in test
Lucian Grijincu [Tue, 15 Sep 2015 22:54:00 +0000 (15:54 -0700)]
folly: async: fix SIOF in test

Summary: avoid sillyness:

```
$ _build/opt/folly/io/async/test/async_test --gtest_list_tests
ASAN:SIGSEGV
=================================================================
==3245135==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000010 (pc 0x000000583444 sp 0x7fff17ba0c40 bp 0x7fff17ba0c80 T0)
    #0 0x583443 in std::_Rb_tree<int, std::pair<int const, folly::SSLContext::SSLLockType>, std::_Select1st<std::pair<int const, folly::SSLContext::SSLLockType> >, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > >::operator=(std::_Rb_tree<int, std::pair<int const, folly::SSLContext::SSLLockType>, std::_Select1st<std::pair<int const, folly::SSLContext::SSLLockType> >, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > > const&) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/bits/stl_tree.h:1138
    #1 0x583443 in std::map<int, folly::SSLContext::SSLLockType, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > >::operator=(std::map<int, folly::SSLContext::SSLLockType, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > > const&) third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/bits/stl_map.h:295
    #2 0x583443 in folly::SSLContext::setSSLLockTypes(std::map<int, folly::SSLContext::SSLLockType, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > >) folly/io/async/SSLContext.cpp:682
    #3 0x40e028 in Initializer folly/io/async/test/AsyncSSLSocketTest2.cpp:143
    #4 0x40e028 in __static_initialization_and_destruction_0 folly/io/async/test/AsyncSSLSocketTest2.cpp:146
    #5 0x40e028 in _GLOBAL__sub_I__ZN5folly47AsyncSSLSocketTest2_AttachDetachSSLContext_Test10test_info_E folly/io/async/test/AsyncSSLSocketTest2.cpp:147
    #6 0x66cf2e in __libc_csu_init /home/engshare/third-party2/glibc/2.20/src/glibc-2.20/csu/elf-init.c:88
    #7 0x7f7145600084 in __libc_start_main (/usr/local/fbcode/gcc-4.9-glibc-2.20-fb/lib/libc.so.6+0x20084)
    #8 0x410be5 (/data/users/lucian/fbcode2/_build/opt/folly/io/async/test/async_test+0x410be5)

AddressSanitizer can not provide additional info.
AAAAAAASUMMARY: AddressSanitizer: SEGV third-party2/libgcc/4.9.x/gcc-4.9-glibc-2.20-fb/024dbc3/include/c++/4.9.x/bits/stl_tree.h:1138 std::_Rb_tree<int, std::pair<int const, folly::SSLContext::SSLLockType>, std::_Select1st<std::pair<int const, folly::SSLContext::SSLLockType> >, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > >::operator=(std::_Rb_tree<int, std::pair<int const, folly::SSLContext::SSLLockType>, std::_Select1st<std::pair<int const, folly::SSLContext::SSLLockType> >, std::less<int>, std::allocator<std::pair<int const, folly::SSLContext::SSLLockType> > > const&)
==3245135==ABORTING
```

Reviewed By: @philippv

Differential Revision: D2440796

9 years agoAdd unit test for update_missing
Kevin Hurley [Tue, 15 Sep 2015 21:06:07 +0000 (14:06 -0700)]
Add unit test for update_missing

Summary: Forgot to add a test for this when I added update_missing.  This adds a test for it

Reviewed By: @yfeldblum

Differential Revision: D2441612

9 years agoPrefer constexpr to preprocessor macros in FBString.h
Yedidya Feldblum [Tue, 15 Sep 2015 20:34:26 +0000 (13:34 -0700)]
Prefer constexpr to preprocessor macros in FBString.h

Summary: [Folly] Prefer `constexpr` to preprocessor macros in `FBString.h`.

Reviewed By: @JoelMarcey

Differential Revision: D2441709

9 years agoNo need to export global instances of folly::AsciiCase(Ins|S)ensitive
Yedidya Feldblum [Tue, 15 Sep 2015 20:21:25 +0000 (13:21 -0700)]
No need to export global instances of folly::AsciiCase(Ins|S)ensitive

Summary: [Folly] No need to export global instances of `folly::AsciiCaseInsensitive` and `folly::AsciiCaseSensitive`.

Calling code may simply construct instances at will - the compiler will optimize away the object construction since it has only the default ctor/dtor, no storage, and no vtable.

Reviewed By: @fugalh

Differential Revision: D2437419

9 years agoDrop support for GCC < 4.8 in folly/FBString.h
Yedidya Feldblum [Tue, 15 Sep 2015 05:48:41 +0000 (22:48 -0700)]
Drop support for GCC < 4.8 in folly/FBString.h

Summary: [Folly] Drop support for GCC < 4.8 in `folly/FBString.h`.

Can't stay indefinitely backcompat with older compilers.

Reviewed By: @JoelMarcey

Differential Revision: D2441747

9 years agoImplement clock_getres for Windows
Orvid King [Mon, 14 Sep 2015 22:53:54 +0000 (15:53 -0700)]
Implement clock_getres for Windows

Summary: Because the windows version of pthread very definitely does not implement the clock. The Cygwin and MinGW headers might, so let them still fall back to the pthread includes.
Closes https://github.com/facebook/folly/pull/280

Reviewed By: @yfeldblum

Differential Revision: D2419067

Pulled By: @JoelMarcey