1. 07 Jan, 2015 5 commits
    • Bob Haarman's avatar
      some fixes for clang-3.5 compatibility · 0f75d2ba
      Bob Haarman authored
      Summary:
      Clang 3.5 performs more rigorous static analysis than compilers we've previously used, and accordingly comes up with some additional warnings. This diff fixes some of the issues clang-3.5 warns about.
      
      Facebook:
      
      Test Plan:
      # after pulling in changes that allow clang-3.5 to be used
      fbconfig --clang --with-project-version clang:3.5 -r common/memory && fbmake runtests_opt
      fbconfig --clang --with-project-version clang:3.5 -r common/strings && fbmake runtests_opt
      fbconfig --clang --with-project-version clang:3.5 folly/test && fbmake runtests_opt
      
      Tests for common/strings and folly/test pass. common/memory has one test failure, which also occurs with clang-3.4, while eliminating a couple of test failures that clang-3.4 had.
      
      Reviewed By: meyering@fb.com
      
      Subscribers: fbcode-common-diffs@, sdwilsh, mathieubaudet, folly-diffs@
      
      FB internal diff: D1761101
      
      Signature: t1:1761101:1419976252:ff60166dc8986e1239f88012b5e552a7d204aede
      0f75d2ba
    • Sean Cannella's avatar
      Don't use FOLLY_TLS on Android · b7912274
      Sean Cannella authored
      Summary:
      emutls as far as StaticMeta needs to use it is broken on
      Android as well due to unspecified pthread_key cleanup order between the
      emulated __thread and our manual uses of it. Use the alternative that we
      use on __APPLE__ there as well.
      
      Test Plan: compiled and ran consuming code on Android
      
      Reviewed By: dancol@fb.com
      
      Subscribers: fma, shikong, kmdent, benyluo, ranjeeth, subodh, folly-diffs@
      
      FB internal diff: D1760569
      
      Tasks: 5265754, 5907613
      
      Signature: t1:1760569:1419955865:afe8f35dadda85393492ac9331e9f62a74f4fdad
      b7912274
    • Sarang Masti's avatar
      Allow conversion from a type T to itself · 821c5d75
      Sarang Masti authored
      Summary: same as title
      
      Test Plan: - fbconfig -r folly && fbmake runtests
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1754577
      
      Signature: t1:1754577:1419618119:4c1a59cd19b23de9a9f6574341944e5e80530d62
      821c5d75
    • Dave Watson's avatar
      SharedThreadPool unittest · 450fee03
      Dave Watson authored
      Summary: Add a test to check that the accept IOPool can be the same as the IO worker thread pool
      
      Test Plan: unittest
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: doug, fugalh, njormrod, folly-diffs@
      
      FB internal diff: D1710628
      
      Signature: t1:1710628:1417469919:6d81a9426b61e9f1b804114f895ed541e547110f
      450fee03
    • Keith Adams's avatar
      Add convenience functions to serialize to / deserialize from string · 1ed040e7
      Keith Adams authored
      Summary: kma asked
      
      Test Plan: tests added
      
      Reviewed By: andrei.bajenov@fb.com
      
      Subscribers: alandau, bmatheny, mshneer, folly-diffs@
      
      FB internal diff: D1756731
      
      Signature: t1:1756731:1419442987:afdccce166ef1f1e609d8894ea587915f6fea8e7
      1ed040e7
  2. 29 Dec, 2014 22 commits
    • Dave Watson's avatar
      Bump version to 20:0 · ba499bab
      Dave Watson authored
      ba499bab
    • Dave Watson's avatar
      Kill fbthrift dep · fbdf69e6
      Dave Watson authored
      Summary:
      (almost) all the necessary code has been moved to folly.  A couple last functions in SSLUtils, moved them to SSLContext
      
      I think this is enough so that open source mcrouter doesn't need an fbthrift dep anymore - although stuff in mcrouter/facebook still uses thrift.
      
      Test Plan:
      fbconfig -r mcrouter; fbmake runtests_dev
      
      contbuild will probably show some other projects to fix up for SSLUtils
      
      Reviewed By: alikhtarov@fb.com
      
      Subscribers: doug, ps, alandau, bmatheny, alikhtarov, mshneer, folly-diffs@
      
      FB internal diff: D1747133
      
      Signature: t1:1747133:1418946064:1c30a60e43f017213e5514d462f267f91761abbe
      fbdf69e6
    • Hans Fugal's avatar
      Fix case of ThreadWheelTimekeeper.cpp in Makefile.am · 71fc7145
      Hans Fugal authored
      Test Plan: jenkins
      
      Reviewed By: ajitb@fb.com
      
      Subscribers: exa, folly-diffs@
      
      FB internal diff: D1758358
      
      Tasks: 5880251
      
      Signature: t1:1758358:1419640865:c9e9ea5922a602c44042c358777067e025800e6e
      71fc7145
    • Hans Fugal's avatar
      (wangle) fix Makefile.am · d4eac831
      Hans Fugal authored
      Summary: Add some forgotten header and cpp files to `Makefile.am` for OSS build of folly.
      
      Test Plan: jenkins
      
      Reviewed By: ajitb@fb.com
      
      Subscribers: exa, folly-diffs@
      
      FB internal diff: D1758318
      
      Tasks: 5880251
      
      Signature: t1:1758318:1419639812:47f527fdb2b3d2c49e7557b4176c6ab2478091ae
      d4eac831
    • Hans Fugal's avatar
      (wangle) Timeouts basic · d1be08e3
      Hans Fugal authored
      Summary:
      Add basic timeout functionality. This adds `futures::sleep` which makes an async Future that finishes after the given duration, and `Future::get` which blocks on the result and takes an optional timeout.
      
      Introducing the folly::wangle::futures namespace (soon to be just folly::futures) which will hold our wangle utility functions, the things that live in the Future object in Twitter's scala code. We'll probably move when* and wait-ish methods in here too, and perhaps alias makeFuture-ish methods too, though James has me mostly convinced not to deprecate them at the folly::wangle level (because they're basically Future constructors and Future lives at folly::wangle)
      
      `Future::delayed` after Twitter's helper of the same name
      
      Test Plan: new and old unit tests
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, fugalh, exa, folly-diffs@
      
      FB internal diff: D1748894
      
      Tasks: 4548494
      
      Signature: t1:1748894:1419363496:1f4a62ec8455989c1fcce845695ace1d01c101c8
      d1be08e3
    • Hans Fugal's avatar
      HHWheelTimer::cancelAll · 062bc87d
      Hans Fugal authored
      Summary: Provide a way to massacre outstanding timers.
      
      Test Plan: new test, and using in wangle (different diff)
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: jsedgwick, exa, folly-diffs@
      
      FB internal diff: D1753866
      
      Tasks: 4548494
      
      Signature: t1:1753866:1419361846:58ff6ca4d01b0d546495b032b454c8bf0fdb0277
      062bc87d
    • Nathan Bronson's avatar
      make futexWaitUntil tolerant of invalid time_point-s · 69433ef3
      Nathan Bronson authored
      Summary:
      futexWaitUntil could generate an invalid timespec when presented
      with a time_point from before the epoch, which resulted in an EINVAL from
      the futex syscall.  Debug builds crashed on this unexpected return value,
      while release builds soldiered on.  This path happened to be exercised
      by the unit test.  This diff fixes the unintentional deadline overflow
      in the test, adds explicit testing of overflow behavior, and makes
      futexWaitUntil handle invalid time_points in a sensible manner.
      
      Test Plan:
      1. new unit tests
      2. fbmake runtests_dbg
      
      Reviewed By: mssarang@fb.com
      
      Subscribers: strager, njormrod, folly-diffs@
      
      FB internal diff: D1747972
      
      Tasks: 5853949
      
      Signature: t1:1747972:1419382193:862c193a13428d96acb33c85f962f59203661f40
      69433ef3
    • Tao Chen's avatar
      Revert "folly: AsyncServerSocket::getAddress: prefer IPv6" · ef2fa20f
      Tao Chen authored
      Summary: This reverts commit fc83e983e2376bccc80dc4b21890e3a41dbc211f.
      
      Test Plan: none
      
      Reviewed By: lucian@fb.com, robot9@fb.com
      
      Subscribers: ps, bmatheny, folly-diffs@
      
      FB internal diff: D1756753
      
      Tasks: 5883894, 5886688
      
      Signature: t1:1756753:1419374764:977160379cfa49530babb38022b9d4cc80573a7d
      ef2fa20f
    • Viswanath Sivakumar's avatar
      Allow unregistering connect callback in AsyncSocket · 98a687df
      Viswanath Sivakumar authored
      Summary:
      Sometimes when the socket is destroyed from a destructor, we wouldn't
      want further callbacks on shutdown. We can unregister the readCallback_
      by calling setReadCB(nullptr), but if the state is CONNECTING, we can
      still get connectErr() callback. I found an ASAN trace (https://phabricator.fb.com/P18837265)
      that turned out to be because of this inability to cancel this callback.
      This provides a way to unregister the connect callback as well.
      
      Test Plan: fbconfig -r folly && fbmake runtests
      
      Reviewed By: afrind@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1751778
      
      Tasks: 5852935
      
      Signature: t1:1751778:1419363638:26967c2d4fc5819e4d65ae706d217a954dfd784f
      98a687df
    • Chip Turner's avatar
      Fix incorrect 'test' statement in unit test · b61dfbeb
      Chip Turner authored
      Summary:
      The 'test' command uses one equal sign for string equality, not
      two.  bash apparently is okay with two, but zsh isn't, causing this test
      to pass if your shell was bash and fail if it was zsh.  The test now
      passes with bash, bash in sh mode, zsh, and even dash.
      
      Test Plan:
      runtests, also, these pass (zsh failed before):
      
      SHELL=/bin/bash _build/dbg/folly/test/subprocess_test
      SHELL=/bin/sh _build/dbg/folly/test/subprocess_test
      SHELL=/bin/zsh _build/dbg/folly/test/subprocess_test
      SHELL=/bin/dash _build/dbg/folly/test/subprocess_test
      
      Reviewed By: njormrod@fb.com
      
      Subscribers: lins, anca, folly-diffs@
      
      FB internal diff: D1756090
      
      Signature: t1:1756090:1419360674:8576e61a6e0ee102612c5eae0e1fbd79cc397bfa
      b61dfbeb
    • Chip Turner's avatar
      Fix Dwarf path handling to fix broken test · 2799131d
      Chip Turner authored
      Summary:
      Simplify the logic slightly to better handle joining paths.
      This makes DwarfTest.cpp pass.
      
      Test Plan: runtests
      
      Reviewed By: njormrod@fb.com
      
      Subscribers: lins, anca, folly-diffs@
      
      FB internal diff: D1756036
      
      Tasks: 5871014
      
      Signature: t1:1756036:1419359254:123cc508b8836ea0b1485abe361b1c158538aa08
      2799131d
    • Mike Kolupaev's avatar
      folly::AtomicHashMap: fixed race between erase() and find() · b4746252
      Mike Kolupaev authored
      Summary: advancePastEmpty() was called for all created iterators. It only makes sense for begin(). For find() it's harmful: find() shouldn't return an iterator to the next element if the key was removed. I suspect that the same race condition was possible for insert(), but I haven't tried to reproduce it.
      
      Test Plan: Added a test for it. It fails without these changes.
      
      Reviewed By: delong.j@fb.com
      
      Subscribers: folly-diffs@, lovro
      
      FB internal diff: D1751280
      
      Tasks: 5841499
      
      Signature: t1:1751280:1419107193:71311ff68d92d0a4dcf1941dacdfdc23c25255cc
      b4746252
    • Lucian Grijincu's avatar
      folly: AsyncServerSocket::getAddress: prefer IPv6 · cc42e3ad
      Lucian Grijincu authored
      Summary: Can't connect from ipv6-only cluster to ipv4/ipv6 service which uses different ports.
      
      Test Plan:
      ```
      ./fastcopy_server --dir . &
      
      # netstat -atnlp | grep LISTEN | grep fastc
      tcp        0      0 0.0.0.0:65478               0.0.0.0:*                   LISTEN      9348/./fastcopy_ser
      tcp        0      0 :::52793                    :::*                        LISTEN      9348/./fastcopy_ser
      ```
      
      Reviewed By: philipp@fb.com, sdoroshenko@fb.com
      
      Subscribers: ps, bmatheny, folly-diffs@
      
      FB internal diff: D1752846
      
      Tasks: 5868818
      
      Signature: t1:1752846:1419043494:7cc0646882249f17258ade5ce7ae5619b13148a0
      cc42e3ad
    • Andrei Alexandrescu's avatar
      Bring fbstring::operator+ to date with C++11 · dff24ff9
      Andrei Alexandrescu authored
      Summary: Some overloads, particularly with rvalue references, were missing. Also this fixes https://our.intern.facebook.com/intern/tasks/?t=5849579
      
      Test Plan: unittests
      
      Reviewed By: simpkins@fb.com
      
      Subscribers: trunkagent, las, net-systems@, njormrod, folly-diffs@
      
      FB internal diff: D1746319
      
      Tasks: 5849579
      
      Signature: t1:1746319:1418875228:febb965cf52710a5e76b7c1cce5aec601086ad90
      dff24ff9
    • Sarang Masti's avatar
      Allow conversion from StringPiece to StringPiece · 5219f070
      Sarang Masti authored
      Summary: Allow conversion from folly::StringPiece to folly::StringPiece
      
      Test Plan: - fbconfig -r folly && fbmake runtests
      
      Reviewed By: mpawlowski@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1752609
      
      Signature: t1:1752609:1419037172:04846f658901306b53fb60c9eafbdf0f4d4d7005
      5219f070
    • Kai Wang's avatar
      Print linux TID while crashing · 36194fe4
      Kai Wang authored
      Summary:
      For servers using GLOG, all thread ID are get from gettid system call. So it
      is very useful if we print this ID so during debugging I can find the log
      of crashing thread.
      
      I'm not sure who should review this diff. Just found you guys from previous
      diffs touched this file :)
      
      Test Plan:
      See the crash log.
      *** Aborted at 1419029404 (Unix time, try 'date -d @1419029404') ***
      *** Signal 11 (SIGSEGV) (0x18) received by PID 18852 (pthread TID 0x7f52a1fff700) (linux TID 27908), stack trace: ***
      
      Reviewed By: tudorb@fb.com
      
      Subscribers: seanc, folly-diffs@
      
      FB internal diff: D1752301
      
      Signature: t1:1752301:1419032887:e43c2ace6914e54812149a8b8e84eaffaf42a09c
      36194fe4
    • Andrew Gallagher's avatar
      Various Dwarf::Path fixes · 3468cb59
      Andrew Gallagher authored
      Summary:
      - Allow both `baseDir` and `subDir` to be empty.  This can happen
      if DW_AT_comp_dir is `.` and gets simplified to the empty string.
      (The DWARF standard doesn't appear to disallow relative dirs here,
      but I couldn't find anthing definitive).
      - Fix `./` prefix  stripping to avoid making paths like `.///hello` absolute.
      - Fix `/` suffix stripping to avoid making the root dir reference (`/`) empty.
      - Do `baseDir` and `subDir` swapping after simplification.
      
      Test Plan: Added unittests.
      
      Reviewed By: njormrod@fb.com
      
      Subscribers: trunkagent, sdwilsh, folly-diffs@
      
      FB internal diff: D1747978
      
      Signature: t1:1747978:1419014942:87f14cb31b8c19b524d7a95b14d63cf5661a8634
      3468cb59
    • Tudor Bosman's avatar
      Add comment explaining that RWTicketSpinLock<..., true> is not reentrant · 5a65b2bd
      Tudor Bosman authored
      Test Plan: no, it's a comment
      
      Reviewed By: zanfur@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1752850
      
      Tasks: 5823969
      
      Signature: t1:1752850:1419043661:673c68c0daad28b3fde9709e767b528b0dec8ad1
      5a65b2bd
    • Mike Kolupaev's avatar
      Fixed folly::AtomicHashMap::iterator not advancing past empty submaps · d8d3e267
      Mike Kolupaev authored
      Summary: A potential "real life" scenario that maybe can hit this bug is if we erase almost all elements and then iterate over the whole map.
      
      Test Plan: Added a test for it.
      
      Reviewed By: mwilliams@fb.com
      
      Subscribers: folly-diffs@, lovro
      
      FB internal diff: D1751455
      
      Tasks: 5866368
      
      Signature: t1:1751455:1419016611:b44c41d348f54397844460cb38002ad0d9704972
      d8d3e267
    • Giuseppe Ottaviano's avatar
      Remove unnecessary constraint from Range subpiece constructor · 0b028d4a
      Giuseppe Ottaviano authored
      Summary:
      D1746899 enforced the constraint (previously in a comment) on the
      constructor `Range(const Range&, size_t, size_t)` that `Iter` is a
      `const char*`. There is however no reason for this constraint.
      
      This patch generalizes and simplifies the constructor, and since it
      has the same semantics as `subpiece`, the latter is implemented in
      terms of the constructor.
      
      Test Plan:
      fbconfig -r folly && fbmake runtests_opt
      
      Reviewed By: soren@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1747958
      
      Signature: t1:1747958:1418930360:fcd6beeda34e64ec8a34b9491a57674ae2265596
      0b028d4a
    • Dave Watson's avatar
      Move TAsyncTransport to folly as AsyncTransportWrapper · 580fc806
      Dave Watson authored
      Summary:
      This temporary class will be useful to cut dependencies on thrift
      while (roughly) maintaining the old interface.
      
      Fixup various test classes that depend on the interface.  Next diff will be to cut fbthrift dep in proxygen/mcrouter
      
      Test Plan: unit tests, jenkins
      
      Reviewed By: hans@fb.com
      
      Subscribers: fbcode-common-diffs@, andrewcox, alandau, bmatheny, alikhtarov, mshneer, trunkagent, doug, njormrod, folly-diffs@, davejwatson
      
      FB internal diff: D1696094
      
      Signature: t1:1696094:1418762312:6028815cce2845ac5f8e754132a038fabf5fd957
      580fc806
    • James Sedgwick's avatar
      onError callbacks · ddb579a2
      James Sedgwick authored
      Summary:
      We've discussed these a bunch and here they are. I stole a bunch of Hannes' magic from https://www.facebook.com/groups/715931878455430/permalink/772854686096482/ to make this easier
      
      Test Plan: added lots of unit tests
      
      Reviewed By: hans@fb.com
      
      Subscribers: fugalh, folly-diffs@, hannesr
      
      FB internal diff: D1748418
      
      Signature: t1:1748418:1418945606:e14c7d6a31245e222bc6a0d259d0e2b9ddd5a830
      ddb579a2
  3. 18 Dec, 2014 13 commits
    • JoelMarcey's avatar
      Bump version to 19:0 · 6f9b619d
      JoelMarcey authored
      6f9b619d
    • James Sedgwick's avatar
      codemod: merge folly/wangle and folly/experimental/wangle · 5e8d8951
      James Sedgwick authored
      Summary:
      Various TARGETS could definitely use some rearranging but I'd rather wait until we're cut over to the new repo
      
      Test Plan: wait for contbuild
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: ptarjan, joelm, trunkagent, hphp-diffs@, ps, fbcode-common-diffs@, fugalh, alandau, bmatheny, everstore-dev@, mwa, jgehring, fuegen, mshneer, folly-diffs@, hannesr
      
      FB internal diff: D1740858
      
      Tasks: 5802833
      
      Signature: t1:1740858:1418752569:4d7d9c5b955e4d9fab4b322cf08a3d285e3db7ce
      5e8d8951
    • Dave Watson's avatar
      fix make test · ee2704c5
      Dave Watson authored
      Summary: autotools is fun.  rule name has to match
      
      Test Plan: No contbuild for this, only a jenkins hourly build: https://ci-builds.fb.com/job/folly/
      
      Reviewed By: noamler@fb.com
      
      Subscribers: doug, net-systems@, folly-diffs@
      
      FB internal diff: D1747221
      
      Signature: t1:1747221:1418929497:a29320b5e21a657fe7e0221d2bea8b332626627b
      ee2704c5
    • Dave Watson's avatar
      remove Cpp2WorkerFactory · 8b3f89ae
      Dave Watson authored
      Summary:
      In preparation for a global IOThreadPoolExecutor - we can't override the workerFactory if we are using a global one.
      
      Instead, add a new getEventBases() to IOTHreadPoolExecutro and just run code on each eventBase.  For shutdown, explicitly add a stop(), instead of doing the work after loop() as exited
      
      Cpp2Worker required minor changes to be able to use EventBaseManager's eventbase vs. their own
      
      Test Plan: fbconfig -r thrift/lib/cpp2; fbmake runtests
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: trunkagent, andrewcox, doug, fugalh, alandau, bmatheny, mshneer, folly-diffs@
      
      FB internal diff: D1734795
      
      Signature: t1:1734795:1418759367:b45f419e5cbc482a64a5873d9e00e3bcb071db5a
      8b3f89ae
    • Giuseppe Ottaviano's avatar
      Disable implicit conversions from std::string for non-char* Range · c1a244da
      Giuseppe Ottaviano authored
      Summary:
      `Range<Iter>` has an implicit constructors from strings for any
      `Iter`, however such constructors are invalid (compilation fails)
      if `Iter` is not `[const] char *`.
      
      This can be an issue for overload resolution: for example
      
      struct IsString {
      bool operator()(folly::Range<int*>) { return false; }
      bool operator()(folly::StringPiece) { return true; }
      };
      
      IsString()(std::string());
      
      fails to compile because the overload is ambiguous, even if the
      conversion to `ByteRange` is invalid.
      
      This patch disables all the invalid constructors from
      `[const] char*`, `std::string`, and `fbstring`.
      
      Test Plan:
      fbconfig -r folly && fbmake runtests_opt
      
      Reviewed By: philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1746899
      
      Signature: t1:1746899:1418868361:50784c4993df0bd96eeb62c09c659d5e53964d9b
      c1a244da
    • James Sedgwick's avatar
      stabilize IOFuturePool test · af581fbe
      James Sedgwick authored
      Summary: see attached task. concurrency is hard.
      
      Test Plan: stress ran the hell out of it, induced failures before, can't after
      
      Reviewed By: hans@fb.com
      
      Subscribers: fugalh, folly-diffs@
      
      FB internal diff: D1746879
      
      Tasks: 5589311
      
      Signature: t1:1746879:1418860467:0ec3f51a398eee8a836532770682a4c58758ce93
      af581fbe
    • Adam Simpkins's avatar
      fix the open source build · 4ef6b6d4
      Adam Simpkins authored
      Summary: Fix the path to detail/SpinLockImpl.h in Makefile.am
      
      Test Plan: Will confirm the Jenkins builds pass for fbthrift and proxygen.
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1745795
      
      Signature: t1:1745795:1418841636:8a861275a62b018a8181541c7d70ba0890d7129f
      4ef6b6d4
    • Laurent Demailly's avatar
      fix bug with elf object left with file open upon error causing Entered fatal... · 56b62698
      Laurent Demailly authored
      fix bug with elf object left with file open upon error causing Entered fatal signal handler recursively later
      
      Summary: fix bug with elf object left with file open upon error causing Entered fatal signal handler recursively later
      
      Test Plan: run publisher at the limit
      
      Reviewed By: tudorb@fb.com
      
      Subscribers: trunkagent, chip, folly-diffs@
      
      FB internal diff: D1743052
      
      Tasks: 5752190
      
      Signature: t1:1743052:1418780889:ad2ee0e6999cf417c2b9fd1ef6bc82d2086774a1
      56b62698
    • Adam Simpkins's avatar
      SpinLock improvements · e4ef6050
      Adam Simpkins authored
      Summary:
      This makes several improvements to the SpinLock code:
      
      - Add a SpinLock implementation using pthread_spinlock_t.  On non-x86_64
      platforms this is preferred over the pthread_mutex_t implementation
      when available.
      
      - For the pthread implementations, throw std::system_error on error,
      rather than completely aborting the program using glog's CHECK()
      macros.
      
      - Update the pthread_mutex_t implementation to call
      pthread_mutex_destroy() on destruction.
      
      - Always unit test all implementations that can be compiled on the
      current build platform, even though only a single implementation will
      be selected as folly::SpinLock.  This way x86_64 builds will still
      unit test the pthread-based implementations.
      
      Test Plan: Ran the unit tests.
      
      Reviewed By: seanc@fb.com
      
      Subscribers: trunkagent, doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1735770
      
      Signature: t1:1735770:1418445953:b238aa8fb835a8d55e6e98e20c4615ae1938b98f
      e4ef6050
    • Adam Simpkins's avatar
      remove PortableSpinLock.h · 6b3d35fc
      Adam Simpkins authored
      Summary:
      Remove the PortableSpinLock header file now that all call sites have
      been migrated to the new SpinLock name.
      
      Test Plan: Built and ran unit tests for folly, thrift, and proxygen.
      
      Reviewed By: seanc@fb.com
      
      Subscribers: trunkagent, doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1734685
      
      Signature: t1:1734685:1418335405:e834f64d7282393e942a1de3638f4cf67410eaab
      6b3d35fc
    • Adam Simpkins's avatar
      update call sites to use SpinLock · 87520af5
      Adam Simpkins authored
      Summary:
      Update call sites to use the new folly::SpinLock name, instead of
      folly::io::PortableSpinLock.
      
      Test Plan: Built and ran the folly unit tests.
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1734647
      
      Signature: t1:1734647:1418334925:1bbcffccd06907224de2a102f8d4bfbe1bd62fd1
      87520af5
    • Adam Simpkins's avatar
      rename io::PortableSpinLock to SpinLock · 4494e275
      Adam Simpkins authored
      Summary:
      folly::io::PortableSpinLock seems generally useful outside of the io
      code.  This moves it into the base folly namespace, and renames it from
      PortableSpinLock to just SpinLock.
      
      For most users, the main difference between MicroSpinLock and SpinLock
      is that SpinLock provides a constructor that does the right thing, while
      MicroSpinLock has to be explicitly initialized.
      
      Test Plan:
      Added some new unit tests, and tested both the MicroSpinLock and
      pthread_spinlock_t implementations.  I didn't test the Mac OS version,
      although that code remains unchanged.
      
      Reviewed By: seanc@fb.com
      
      Subscribers: trunkagent, doug, net-systems@, exa, folly-diffs@
      
      FB internal diff: D1734632
      
      Signature: t1:1734632:1418394033:99f6fbe73b485a1d631a2ef7d1b39ea6f49ecb0b
      4494e275
    • Andrii Grynenko's avatar
      get_fast/get_weak_fast API for folly::Singleton · 249e3805
      Andrii Grynenko authored
      Summary: This adds API which makes folly::Singleton as performant as Meyers/static-object singletons.
      
      Test Plan:
      unit test + benchmark
      
      ============================================================================
      folly/experimental/test/SingletonTest.cpp       relative  time/iter  iters/s
      ============================================================================
      NormalSingleton                                            333.32ps    3.00G
      MeyersSingleton                                  100.00%   333.33ps    3.00G
      FollySingletonSlow                                 0.35%    94.36ns   10.60M
      FollySingletonFast                                99.43%   335.24ps    2.98G
      FollySingletonFastWeak                             0.62%    53.74ns   18.61M
      ============================================================================
      
      Reviewed By: alikhtarov@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1741961
      
      Signature: t1:1741961:1418765462:d9806f1bf5275bfbe2c4c53a41b735bda93753fe
      249e3805