(folly) QueuedImmediateExecutor

Summary: Add the `QueuedImmediateExecutor` which behaves like `InlineExecutor` but with different (and usually better) ordering semantics for nested calls.
@override-unit-failures

Test Plan: unit tests

Reviewed By: davejwatson@fb.com

Subscribers: folly@lists, net-systems@, fugalh, exa

FB internal diff: D1364904

Tasks: 3789661
Fix bizarre optimization

Summary:
I have no idea why the compiler is gettings its britches in a bunch because a unit test has a predictable output. Really, gcc?!

But whatever, avoiding inlining by putting it in the cpp file solves it.

Test Plan: fbmake runtests_opt

Reviewed By: davejwatson@fb.com

Subscribers: net-systems@, fugalh, exa

FB internal diff: D1405811

Tasks: 4591823
nuke executeWith

Summary: Removing this crufty API. The only callsite for `executeWith` was `Later::via` so I just folded it in there.

Test Plan:
unit tests
contbuild

Reviewed By: hannesr@fb.com

Subscribers: net-systems@, fugalh, exa

FB internal diff: D1406592

Tasks: 4480567
(wangle) s/continuation/callback

Summary: The word "continuation" is too ambiguous. Prefer callback (except where we are actually talking about CSP continuations in the README).

Test Plan: Still builds. Nothing external is or should be calling `setContinuation`. But I'll wait for contbuild anyway.

Reviewed By: hannesr@fb.com

Subscribers: net-systems@, fugalh, exa

FB internal diff: D1406753

Tasks: 4480567
(wangle) noexcept move constructor

Summary: to make lint happy

Test Plan: builds

Reviewed By: hannesr@fb.com

Subscribers: net-systems@, fugalh, exa

FB internal diff: D1406766

Tasks: 4480567
Fix use-after-free in futexWaitUntilImpl

Summary: Handle wake-ups correctly in futexWaitUntilImpl.

Test Plan:
-- ran all folly unit tests
-- ran TimeoutWorkQueue test under tao/queues

Reviewed By: ngbronson@fb.com, meyering@fb.com

FB internal diff: D1406845

Tasks: 4494871
folly: futexWaitUntilImpl: avoid abort triggered via tao/queues tests

Summary:
* folly/test/DeterministicSchedule.cpp (folly): Tao/queues tests exposed
an unhandled case in this code: when (futex->data == expected) happens,
we would call futexErrnoToFutexResult with a futexErrno value of 0,
which would cause an abort (unhandled valued in switch).
Here's a stack trace from the abort: https://phabricator.fb.com/P12558008
showing the invalid futexErrno value in frame #4.

Test Plan:
fbconfig -r --platform-all=gcc-4.8.1-glibc-2.17 --sanitize=address tao/queues:TimeoutWorkQueueTests
_bin/tao/queues/WorkQueueTests -fbunit_test_regexp '^mt\_stress\_deterministic$'

Reviewed By: mssarang@fb.com

FB internal diff: D1404572

Tasks: 4494871
(wangle) Return a Later from Future::via

Summary: Stroke of brilliance, Hannes.

Test Plan:
unit tests, including a new one
Looked through `fbgs 'via('` and all the extant `via`s are attached to `Later`s already so it shouldn't break anything. But check contbuild before commit.

Reviewed By: hannesr@fb.com

Subscribers: net-systems@, fugalh, exa

FB internal diff: D1406976

Tasks: 4480567
Fix folly on OSX and BSD in prep for FastCGI on HHVM

Summary:
A recent change in folly/MemoryMapping.cpp uses MAP_ANONYMOUS, which is
named MAP_ANON on OSX/BSD.

We need folly and third-party changes in order to land a pull request for HHVM
that starts to get FastCGI running on OSX.

See the checklist of the HHVM pull request here: https://github.com/facebook/hhvm/pull/2944#issuecomment-47281003

Closes #67

GitHub Author: Daniel Sloof <goapsychadelic@gmail.com>

@override-unit-failures

Test Plan: fbmake runtests 100%

Reviewed By: pt@fb.com, njormrod@fb.com

FB internal diff: D1407393
Be explicit about what we're passing to Endian::big

Summary:
This prevents a linker error on OSX:
```
Undefined symbols for architecture x86_64:
"folly::detail::EndianIntBase::swap(unsigned long)",
referenced from:
__GLOBAL__sub_I_MacAddress.cpp in libfolly.a(MacAddress.cpp.o)
ld: symbol(s) not found for architecture x86_64
```

We need folly and third-party changes in order to land a pull request for HHVM
that starts to get FastCGI running on OSX.

See the checklist of the HHVM pull request here: https://github.com/facebook/hhvm/pull/2944#issuecomment-47281003

Closes #68

GitHub Author: Daniel Sloof <goapsychadelic@gmail.com>

@override-unit-failures

Test Plan: fbmake runtests 100%

Reviewed By: pt@fb.com, njormrod@fb.com

FB internal diff: D1407426
Merge remote-tracking branch 'upstream/master'