1. 09 Jul, 2014 4 commits
    • Tudor Bosman's avatar
      Use pipe2 in Subprocess; platform-specific config · 217e88e6
      Tudor Bosman authored
      Summary:
      We've wanted to use pipe2 in Subprocess for a while, but that's not supported
      on glibc 2.5.1. This is not a problem in OSS (autoconf can solve this),
      but, internally, we don't run autoconf; add an internal platform include file
      with such per-platform differences.
      
      Test Plan: fbconfig -r folly && fbmake runtests_opt
      
      Reviewed By: meyering@fb.com
      
      Subscribers: jhj, lesha, kma, agallagher
      
      FB internal diff: D1422128
      217e88e6
    • Tom Jackson's avatar
      stride() · 2015ae71
      Tom Jackson authored
      Summary: thatwaseasy
      
      Test Plan: iloveunittests
      
      Reviewed By: lucian@fb.com
      
      Subscribers: philipp
      
      FB internal diff: D1419848
      
      Tasks: 4636617
      2015ae71
    • Brian Pane's avatar
      Move the branchless, parallel ASCII toLower into folly · db66e2f4
      Brian Pane authored
      Summary:
      * Moved the fast toLower code into folly
      * Updated the name to emphasize that it's ASCII-only
      
      Test Plan: * Unit tests and benchmarks included.
      
      Reviewed By: tudorb@fb.com
      
      Subscribers: ruibalp, bmatheny
      
      FB internal diff: D1421056
      db66e2f4
    • Hans Fugal's avatar
      (wangle) fix shadow · a0d5122f
      Hans Fugal authored
      Summary: Not sure why this shadow error didn't turn up in my tests, but whatevs
      
      Test Plan: traffic manager builds without warning-errors
      
      Reviewed By: suhas@fb.com
      
      Subscribers: hannesr, net-systems@, fugalh, exa
      
      FB internal diff: D1421495
      
      Tasks: 4653938
      a0d5122f
  2. 07 Jul, 2014 10 commits
    • Tudor Bosman's avatar
      fix Makefile.am · 3454265d
      Tudor Bosman authored
      Summary: wangle/detail.h -> wangle/detail/State.h
      
      Test Plan: OSS build
      
      Reviewed By: meyering@fb.com
      
      Subscribers: fugalh, lesha
      
      FB internal diff: D1421490
      3454265d
    • Tudor Bosman's avatar
      gflags now likes namespace gflags, not google · f6a8fe63
      Tudor Bosman authored
      Summary:
      Use namespace gflags going forward, import namespace google into it if
      backward.
      
      Also added a few "checking for..." messages in autoconf.
      
      Test Plan: fbconfig -r folly && fbmake runtests_opt, OSS build
      
      Reviewed By: meyering@fb.com
      
      Subscribers: fjargsto, ntv, jhj, lesha, kma, davejwatson
      
      FB internal diff: D1420575
      f6a8fe63
    • Hans Fugal's avatar
      (wangle) cold via · 73e3273b
      Hans Fugal authored
      Summary:
      Instead of returning a Later, `via` returns a cold future.
      This works without keeping a backreference like Later does, because an inactive Future will always activate on destruction. Alternatively we could have an extra Promise, a la Later, and pass that along like Later does, and require launch() at the end (though, implicit launching on destruction would be an option there too).
      
      If you think this approach is viable I'll clean it up on Wednesday: make sure all the calling sites work, etc.
      
      Test Plan:
      new unit test
      This may fail in contbuild, I haven't done the codemod for calling sites, if there are any.
      
      Reviewed By: hannesr@fb.com
      
      Subscribers: jsedgwick, net-systems@, fugalh, exa
      
      FB internal diff: D1412499
      
      Tasks: 4480567
      73e3273b
    • Hans Fugal's avatar
      (wangle) Future/Promise detachment · 03f41278
      Hans Fugal authored
      Summary:
      Bring a bit more sanity to the lifetime. Now Future and Promise detach by calling the respective methods on State, and they do it during their destruction only. State manages its own lifetime.
      
      Besides being cleaner, this also sets the stage for cancellation (where we'll need Future to hang on to its reference to State after setting the callback), and for folding in Later (we will have a bool for whether the future is hot and hold off executing the callback if it isn't).
      
      Also cleans up various things I noticed while auditing the code for usages of `state_`.
      
      Test Plan:
      All the unit tests still pass.
      Ran with ASAN (and found I had introduced a bug, then fixed it. yay)
      
      Reviewed By: hannesr@fb.com
      
      Subscribers: jsedgwick, net-systems@, fugalh, exa
      
      FB internal diff: D1412038
      
      Tasks: 4618297
      03f41278
    • Hannes Roth's avatar
      (Folly/FBString) Enum class for category · 7609a2fb
      Hannes Roth authored
      Summary: Suggested by @aalexandre.
      
      Test Plan: Compile.
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: folly@lists, njormrod, aalexandre
      
      FB internal diff: D1246180
      7609a2fb
    • Lucian Grijincu's avatar
      folly: StringPiece: add skipWhitespace · 38fb7acd
      Lucian Grijincu authored
      Test Plan: copied from folly::json
      
      Reviewed By: philipp@fb.com, soren@fb.com
      
      FB internal diff: D1417992
      
      Tasks: 4527315
      38fb7acd
    • Hans Fugal's avatar
      s/setCallback_/setCallback/ for detail::State · 368266c3
      Hans Fugal authored
      Summary: This isn't really an internal-to-this-class method. :-/
      
      Test Plan: builds
      
      Reviewed By: hannesr@fb.com
      
      Subscribers: jsedgwick, net-systems@, fugalh, exa
      
      FB internal diff: D1412008
      368266c3
    • Hans Fugal's avatar
      (wangle) s/continuation_/callback/ (missed some) · 82ab3bae
      Hans Fugal authored
      Summary: In the spirit of D1406753
      
      Test Plan: still builds and tests pass
      
      Reviewed By: hannesr@fb.com
      
      Subscribers: jsedgwick, net-systems@, fugalh, exa
      
      FB internal diff: D1412002
      82ab3bae
    • Hans Fugal's avatar
      (wangle) s/FutureObject/detail::State/ · 1d42dc0b
      Hans Fugal authored
      Summary:
      codemod
      I never was satisfied with this name. `State` feels a little better. More descriptive. But still pretty generic, so I'm open to alternative ideas.
      
      Test Plan: It still builds and tests pass.
      
      Reviewed By: hannesr@fb.com
      
      Subscribers: jsedgwick, net-systems@, fugalh, exa
      
      FB internal diff: D1411506
      1d42dc0b
    • Kevin Chou's avatar
      Fix string split when last part is shorter than delimiter · 02a9ec75
      Kevin Chou authored
      Summary: The bug is when ignoreEmpty is true, we use the wrong token size, which will be 0 when last token is shorter than delimiter.
      
      Test Plan:
      1. Add unit test
      2. fbconfig -r folly && fbmake runtests
      
      Reviewed By: philipp@fb.com
      
      Subscribers: maxime, xiaol
      
      FB internal diff: D1415803
      02a9ec75
  3. 02 Jul, 2014 1 commit
  4. 01 Jul, 2014 4 commits
    • Dave Watson's avatar
      update make check targets · d175e4ac
      Dave Watson authored
      Summary:
      Update targets so that gtest isn't required unless you run 'make check'.
      
      Simply make everything that uses gtest a 'check_PROGRAM' instead of a 'noinst_PROGRAM'
      
      Test Plan: build folly with 'make -j32', gtest isn't required.
      
      Reviewed By: andrewjcg@fb.com
      
      Subscribers: pavlo, doug
      
      FB internal diff: D1408288
      d175e4ac
    • Tudor Bosman's avatar
      Simplify include path, make sure .. is in it · 4bfe9433
      Tudor Bosman authored
      Summary: so #include <folly/File.h> works
      
      Test Plan: built OSS folly, make check, built tiny program out of tree
      
      Reviewed By: davejwatson@fb.com
      
      FB internal diff: D1412123
      4bfe9433
    • Tudor Bosman's avatar
      Codemod: use #include angle brackets in folly and thrift · ce64f0f6
      Tudor Bosman authored
      Summary: Also changed the thrift compilers to emit code with <...>.
      
      Test Plan: fbconfig -r folly thrift && fbmake opt && fbmake runtests_opt
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: ruibalp, nli, shilin, tjackson, fugalh, alandau, bmatheny, njormrod
      
      FB internal diff: D1411225
      ce64f0f6
    • Philip Pronin's avatar
      fix AsyncIO::doWait · c6bdae86
      Philip Pronin authored
      Summary:
      As it turns out, `io_getevents` may actually return less than
      `min_nr` events.  According to the aio logic
      (https://github.com/torvalds/linux/blob/10b5b5361a3c2a7fff9dbfa0f127adc2531e7732/fs/aio.c#L1634),
      there may be a couple of rounds required to get at least `nr_min` events, and
      if interrupted after the first one, incomplete results would be returned
      
      Test Plan:
      fbconfig -r folly/experimental/io/test && fbmake runtests_opt -32
      
      and was no longer able to repro #4609062
      
      Reviewed By: soren@fb.com
      
      FB internal diff: D1410389
      
      Tasks: 4609062
      c6bdae86
  5. 27 Jun, 2014 10 commits
    • Joel Marcey's avatar
      Be explicit about what we're passing to Endian::big · 09a81a96
      Joel Marcey authored
      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
      09a81a96
    • Joel Marcey's avatar
      Fix folly on OSX and BSD in prep for FastCGI on HHVM · 75f93a66
      Joel Marcey authored
      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
      75f93a66
    • Hans Fugal's avatar
      (wangle) Return a Later from Future::via · a181fa04
      Hans Fugal authored
      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
      a181fa04
    • Jim Meyering's avatar
      folly: futexWaitUntilImpl: avoid abort triggered via tao/queues tests · b27ed0f6
      Jim Meyering authored
      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
      b27ed0f6
    • Sarang Masti's avatar
      Fix use-after-free in futexWaitUntilImpl · 8ee3ba54
      Sarang Masti authored
      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
      8ee3ba54
    • Hans Fugal's avatar
      (wangle) noexcept move constructor · 0498579d
      Hans Fugal authored
      Summary: to make lint happy
      
      Test Plan: builds
      
      Reviewed By: hannesr@fb.com
      
      Subscribers: net-systems@, fugalh, exa
      
      FB internal diff: D1406766
      
      Tasks: 4480567
      0498579d
    • Hans Fugal's avatar
      (wangle) s/continuation/callback · b20a9545
      Hans Fugal authored
      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
      b20a9545
    • Hans Fugal's avatar
      nuke executeWith · ad710a56
      Hans Fugal authored
      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
      ad710a56
    • Hans Fugal's avatar
      Fix bizarre optimization · 57a00d50
      Hans Fugal authored
      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
      57a00d50
    • Hans Fugal's avatar
      (folly) QueuedImmediateExecutor · 339a9d37
      Hans Fugal authored
      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
      339a9d37
  6. 26 Jun, 2014 10 commits
    • Tudor Bosman's avatar
      Oops, fix README · da86cac0
      Tudor Bosman authored
      Reviewed By: meyering@fb.com
      Test Plan: no
      da86cac0
    • Tudor Bosman's avatar
      folly OSS fixes: add ThreadName.h and compression · b56a2049
      Tudor Bosman authored
      Summary: Also, optionalize dependencies on compression libraries.
      
      Test Plan: fbconfig -r folly && fbmake runtests_opt
      
      Reviewed By: meyering@fb.com
      
      Subscribers: kma, jhj, simpkins, lesha, folly@lists
      
      FB internal diff: D1396573
      b56a2049
    • Anton Likhtarov's avatar
      Fix for folly open source build on Ubuntu 12.04 · 6dff66ff
      Anton Likhtarov authored
      Summary: On 12.04, there's both /usr/lib/libiberty.a and /usr/lib/libiberty_pic.a, and _pic is the one we want to build a Folly shared library.
      
      Test Plan: build on Ubuntu 12.04
      
      Reviewed By: meyering@fb.com
      
      FB internal diff: D1402194
      6dff66ff
    • Hans Fugal's avatar
      Scheduler interface of Executor · d7a43326
      Hans Fugal authored
      Summary: and ManualExecutor implementation
      
      Test Plan: unit tests, contbuild
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: bmatheny, folly@lists, net-systems@, fugalh, exa, marccelani, jsedgwick
      
      FB internal diff: D1392999
      
      Tasks: 4548494
      d7a43326
    • Tudor Bosman's avatar
      folly OSS fixes: add ThreadName.h and compression · 0ecc7473
      Tudor Bosman authored
      Summary: Also, optionalize dependencies on compression libraries.
      
      Test Plan: fbconfig -r folly && fbmake runtests_opt
      
      Reviewed By: meyering@fb.com
      
      Subscribers: kma, jhj, simpkins, lesha, folly@lists
      
      FB internal diff: D1396573
      0ecc7473
    • Tudor Bosman's avatar
      Make randomNumberSeed read from /dev/urandom · 6019aaaa
      Tudor Bosman authored
      Summary: Because @lesha asked "why not" and I couldn't give him an answer.
      
      Test Plan: random_test
      
      Reviewed By: bmaurer@fb.com
      
      Subscribers: bmaurer, folly@lists, jhj, kma, lesha, sdoroshenko, soren
      
      FB internal diff: D1394401
      6019aaaa
    • Peter Ruibal's avatar
      Add ThreadName.h to folly's Makefile.am · 418ad481
      Peter Ruibal authored
      Summary:
      fbthrift depends on <folly/ThreadName.h>, which isn't currently
      getting installed as part of the autotools build.  Add it to Makefile.am
      
      Test Plan:
      Made this change to folly, re-autogen/configure/install, and
      then was able to successfully compile fbthrift's compiler
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: doug, folly@lists
      
      FB internal diff: D1397084
      418ad481
    • Yunqi Zhang's avatar
      Expose EVLOOP_NONBLOCK · 51e98fa7
      Yunqi Zhang authored
      Summary:
      This diff allows users to loop through EventBase without blocking if there are
      not any events to process.
      
      This is useful for sending and receiving requests on network, where users just
      want to try if there are any events and do not want to block if not.
      
      https://phabricator.fb.com/D1373887 is an example where we find this feature
      useful, otherwise we have to add an empty callback before loop.
      event_base_.runInLoop([] {});
      event_base_.loopOnce();
      
      @davejwatson, @fugalh, @simpkins, @stepan: Could you please take a look at the
      proposed changes and let me know if there is any better ways of doing this.
      
      Thank you!
      
      Test Plan:
      I think this would not break anything, but we might want to do some performance
      profiling if needed.
      
      Reviewed By: hans@fb.com
      
      Subscribers: simpkins, davejwatson, fugalh, stepan, folly@lists
      
      FB internal diff: D1383401
      51e98fa7
    • Nicholas Ormrod's avatar
      Make fbstring libgcc-safe · a97b3be5
      Nicholas Ormrod authored
      Summary:
      Some libgcc-incompatible code has been added to fbstring.
      Removed/reorganized it so that we can drop fbstring right into libgcc.
      
      Test Plan:
      fbconfig -r folly && fbmake runtests
      
      Copied FBString.h into libgcc's basic_fbstring.h, with no modifications.
      Successfully tp2_build libgcc/4.8.1. Adjusted symlink, then fbmake clean
      && fbconfig -r folly && fbmake dbg. The fbmake dbg failed with an
      assertion error, which is consistent with @lucian's observations in
      D1373725; the important part is that the error was at runtime, so the
      compile-time changes of this diff looks good.
      
      Reviewed By: lucian@fb.com
      
      Subscribers: folly@lists, sdwilsh, njormrod, lucian
      
      FB internal diff: D1382873
      a97b3be5
    • Nicholas Ormrod's avatar
      FBString conservative additions · 58d27d00
      Nicholas Ormrod authored
      Summary:
      Now that fbstring is conservative by default (D1373308), we can remove
      the mutability of the data members and the call to c_str() in operator[].
      
      Test Plan: fbconfig -r folly && fbmake runtests
      
      Reviewed By: lucian@fb.com
      
      Subscribers: folly@lists, sdwilsh, njormrod
      
      FB internal diff: D1382644
      58d27d00
  7. 14 Jun, 2014 1 commit
    • Anton Likhtarov's avatar
      Fix open source build · 1a31dc64
      Anton Likhtarov authored
      Test Plan: build it
      
      Reviewed By: pavlo@fb.com
      
      Subscribers: folly@lists
      
      FB internal diff: D1383722
      1a31dc64