1. 09 Nov, 2016 8 commits
  2. 08 Nov, 2016 3 commits
    • Christopher Dykes's avatar
      Make NeedleFinderTest::Needles256 actually do things · 4aa69c20
      Christopher Dykes authored
      Summary:
      The min value of a `char` is `-128`, but we're initializing our `size_t` i's with it, so, as MSVC quite rightly warns (as C6294) the condition is never true and the loop never loops.
      Fix it by signing our i's.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4145419
      
      fbshipit-source-id: 87591d0f84c54472b1b5847e025d091de3f98bca
      4aa69c20
    • James Sedgwick's avatar
      add tryReadUntil and make fixes along the way · 5eb31cb3
      James Sedgwick authored
      Summary:
      this diff adds tryReadUntil, which is a mirror of tryWriteUntil in both function and implementation.
      Two bugs were exposed in the process of implementing and testing tryWriteUntil; they are fixed as well and are as follows:
        1. tryObtainPromisedPopTicket didn't assign to the passed ticket return reference in the failure case
        2. TurnSequencer::tryWaitForTurn() didn't distinguish between past turns and timeouts in the failure case; they need to be
           differentiated because SingleElementQueue::tryWaitFor{De/En}queue() should only fail in the timeout case, not if the turn has passed.
      
      The two added unit tests are admittedly clumsy, but making the obvious simplifications to them keeps them from triggering the premature timeout race caused by bug 2 above, so I kept them as is.
      
      Reviewed By: magedm
      
      Differential Revision: D4050515
      
      fbshipit-source-id: b0a3dd894d502c44be62d362ea347a1837df4c2f
      5eb31cb3
    • Andrew Gallagher's avatar
      Mark implicitly inlined static locals with default visibility · 782325fd
      Andrew Gallagher authored
      Summary:
      These functions contain static locals which need to be exported to
      the global dynamic symbol table to get deduplicated at runtime.  Since
      using `-fvisibility-inlines-hidden` demotes the visibility of these
      static locals, explicitly tag them.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4139154
      
      fbshipit-source-id: 08b81721c6c945ac5556472481ae771d0eeb5f88
      782325fd
  3. 07 Nov, 2016 2 commits
    • Stepan Palamarchuk's avatar
      Remove noexcept from AsyncSocket::prepareReadBuffer · 5c52b281
      Stepan Palamarchuk authored
      Summary:
      `prepareReadBuffer` is calling a callback function that is not a noexcept
      also `prepareReadBuffer` is being called only from one place, that wraps this function call with try/catch.
      
      Reviewed By: jmswen
      
      Differential Revision: D4138424
      
      fbshipit-source-id: a05bdd6f741761567a7d0291017c285b0bf15522
      5c52b281
    • Andrew Gallagher's avatar
      Annotate some static locals as "library-local" · 5d52fb8c
      Andrew Gallagher authored
      Summary:
      This tags certain static locals, wich may get duplicated via dynamic
      linking and inlining, as safe to have multiple copies at runtime,
      making this subtle behavior explicit.
      
      Reviewed By: igorsugak
      
      Differential Revision: D4082929
      
      fbshipit-source-id: ba4e23cb121e957a43f5659a1ca3432cb89cb8f3
      5d52fb8c
  4. 06 Nov, 2016 1 commit
    • Yedidya Feldblum's avatar
      Let folly::range be constexpr · 621adb9c
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `folly::range` be `constexpr`.
      
      It will be useful to have this helper function be `constexpr` to support further compile-time code.
      
      Reviewed By: juchem
      
      Differential Revision: D4135943
      
      fbshipit-source-id: a62be93f9e492ca302130d1a3b190ed4b69f7a80
      621adb9c
  5. 05 Nov, 2016 1 commit
  6. 04 Nov, 2016 2 commits
    • Zach Amsden's avatar
      Add StringKeyedMap/Set.h to OSS build · 7dd7fd99
      Zach Amsden authored
      Summary: Eden uses this and won't build with OSS folly without it.
      
      Reviewed By: Orvid
      
      Differential Revision: D4132103
      
      fbshipit-source-id: 68d6c7dc642a7401eca60b0713db9f90cc11ced1
      7dd7fd99
    • Mirek Klimos's avatar
      Trying to improve the efficiency of RequestContext callbacks · 245489e2
      Mirek Klimos authored
      Summary: Changed RWSpinLock to a SharedMutex in the RequestContext to see if this would lower the overhead of the onSet/onUnset callbacks.
      
      Reviewed By: djwatson
      
      Differential Revision: D3780396
      
      fbshipit-source-id: 3d91f8194357533072fe053d23e0454a36faecff
      245489e2
  7. 03 Nov, 2016 8 commits
  8. 02 Nov, 2016 3 commits
    • Tudor Bosman's avatar
      Compile RangeSse42.cpp with -msse4.2 · d2c8a36b
      Tudor Bosman authored
      Summary:
      Solves #509 by creating a libtool convenience library that's compiled with -msse4.2.
      Closes https://github.com/facebook/folly/pull/510
      
      Differential Revision: D4120400
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: bf5d937dc37ef8707e755c89f1883d65b4d21b0f
      d2c8a36b
    • Philip Pronin's avatar
      fix race between StaticMetaBase::destroy() and StaticMetaBase::onThreadExit() · 206dce5b
      Philip Pronin authored
      Summary:
      We would like to guarantee that after `folly::ThreadLocal<>` dtor
      returns no per-thread instances are longer alive.  Currently this is not a case:
      
      * T1 is excuting `StaticMetaBase::onThreadExit()`, it acquired all per-thread
        instances and erased them from meta under `accessAllThreadsLock_`.
      * T2 destroys `folly::ThreadLocal<>`, it executes `StaticMetaBase::destroy()`,
        collects all per-thread instances (thus missing the ones being destroyed by
        T1), destroys them and returns.
      * T1 executes dtor of per-thread instances, after parent `folly::ThreadLocal<>`
        dtor is finished.
      
      Reviewed By: ot
      
      Differential Revision: D4109820
      
      fbshipit-source-id: d547b8cc77c9871126538c38644c2e98ddccf220
      206dce5b
    • Ameya Limaye's avatar
      Make sequence number in AtomicBatchDispatcher<....>::Token non-const · 5e1b7327
      Ameya Limaye authored
      Summary:
      Make sequence number in AtomicBatchDispatcher<....>::Token non-const:
      - The field is already private and having it as const prevents a
        move assignment operator from getting defined
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4114851
      
      fbshipit-source-id: 9f7a4003daff02c007c01747cca6ae9da17fcb79
      5e1b7327
  9. 01 Nov, 2016 7 commits
    • Christopher Dykes's avatar
      Don't declare the extern FingerprintTable specializations under MSVC · b9ac5511
      Christopher Dykes authored
      Summary:
      MSVC doesn't allow uninitialized non-`extern` `const` declarations, but we can't mark them `extern` because they are part of a template specialization. We also can't initialize them, because they'd conflict with the definition specializations in the generated tables.
      As the forward-declarations aren't required for it to work under MSVC, as the specializations are found appropriately, just don't declare the specializations under MSVC.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4098282
      
      fbshipit-source-id: 84b73d63bbe6cf9c54b7fe7a3bfc2488699df7c2
      b9ac5511
    • David Callahan's avatar
      Fix CLANG compilation: folly/TokenBucket.h · f490576e
      David Callahan authored
      Summary:
      In the next revision of clang, compilation generates multiple erroes of the form
      
         folly/TokenBucket.h:127:29: error: exception specification is not available until end of  class definition
               double nowInSeconds = defaultClockNow()) {
      
      which are eliminated by reordering the method declaration for defaultClockNow()
      
      Refer https://llvm.org/bugs/show_bug.cgi?id=30860
      
      Reviewed By: philippu, yfeldblum
      
      Differential Revision: D4107443
      
      fbshipit-source-id: ce64f2ae7983e533c2fcb5cb043dbdd3da5c00f7
      f490576e
    • Christopher Dykes's avatar
      Eliminate more VLAs · bc32ffea
      Christopher Dykes authored
      Summary:
      MSVC doesn't support them, so use dynamic allocation instead.
      This also fixes a place where MSVC wasn't propogating the constexpr-ness of a local into the body of a lambda, resulting in an attempt to create a VLA.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4098932
      
      fbshipit-source-id: 742b2fcd96f7f6eceb5043159403d557f7fc9673
      bc32ffea
    • Christopher Dykes's avatar
      uint8_t isn't a valid template argument for uniform_int_distribution · b106dcc7
      Christopher Dykes authored
      Summary: Clang and GCC allow it, but the spec, and MSVC, don't, so use uint16_t instead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4099285
      
      fbshipit-source-id: cdf7ba14b6c00e1bcdfc3650b76e6e4a47a61929
      b106dcc7
    • Christopher Dykes's avatar
      Silence a couple of warnings for MSVC in Optional.h · c39c808c
      Christopher Dykes authored
      Summary: Silence a couple of warnings that get very spammy for MSVC.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4098682
      
      fbshipit-source-id: b410b56062cdf82367675ea9c3dd22975e7b91bd
      c39c808c
    • Andrii Grynenko's avatar
      Fix BoostContextCompatibility for boost >= 1.61 · 823ecf89
      Andrii Grynenko authored
      Reviewed By: yfeldblum
      
      Differential Revision: D4100221
      
      fbshipit-source-id: 7778b48f1bba9be85f5712f61d6e1731524901c3
      823ecf89
    • Andrii Grynenko's avatar
      Simplify the API exposed by BoostContextCompatibility · 10191891
      Andrii Grynenko authored
      Summary: Instead of exposing raw jumpContext, it now exposes a higher-level FiberImpl class, which can be extended for newer versions of jump_fcontext.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4099849
      
      fbshipit-source-id: 28c7ce32284a0109cf040c264d46a31a45867934
      10191891
  10. 31 Oct, 2016 5 commits
    • Andrii Grynenko's avatar
      Simplify activateFiber()/deactivateFiber() · 9b30deab
      Andrii Grynenko authored
      Summary: A cleanup in preparation to make folly::fibers work with newer boost.
      
      Reviewed By: jsedgwick
      
      Differential Revision: D4093947
      
      fbshipit-source-id: e9a0aaeb915c40af96282169d4758afe572f2dd8
      9b30deab
    • Maged Michael's avatar
      Update hazard pointers interface and implementation · c45de72c
      Maged Michael authored
      Summary:
      The main purpose of this diff and this library at this point is to be a public reference for the C++ standard committee and whoever is interested in the proposal to the committee.
      
      This diff aims to be consistent with the latest version of the proposal (http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0233r2.pdf).
      
      The current interface proposal focuses on the core components (domain, object base, and raii owner). Once, that part is settled we can add to the interface:
      - Thread local options (thread caching of hazard pointers and private storage of retired objects)
      - Programmer control of reclamation (when and by which threads)
      Also, at this point the implementation does not optimize memory ordering.
      
      I removed hazptr_domain::try_reclaim() from the public interface at this point. The latest update to interface aims to relieve the programmer from the need to take spacial precautions against shutdown fiascos involving reclamation functions of objects stored by the default domain. Please let me know if you have any concerns about this.
      
      Having said that about the current purpose of this library, I really appreciate any comments (in this diff or separately) on the interface in general and any suggestions for the eventual optimized implementation.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D4104381
      
      fbshipit-source-id: df98adf6fd9b7a93406cb8eeca8fe2ad12388139
      c45de72c
    • Lucian Grijincu's avatar
      folly: AsyncSignalHandler: update comments to match code · 21d7adcd
      Lucian Grijincu authored
      Summary: #accept2ship
      
      Reviewed By: jsedgwick
      
      Differential Revision: D4105140
      
      fbshipit-source-id: eca1f7066e514ec3c5d316f974edc34e03872784
      21d7adcd
    • Christopher Dykes's avatar
      Access the individual words of an IPv6 address correctly in IPAddressTest on Windows · ec1cb4c0
      Christopher Dykes authored
      Summary: Winsock defines the internals of `in6_addr` in its own way, so we have to account for that.
      
      Reviewed By: jsedgwick
      
      Differential Revision: D4099453
      
      fbshipit-source-id: c0ebb4e2017f61bed7d5d63058161ef3f16f9a65
      ec1cb4c0
    • Christopher Dykes's avatar
      In the portability implementation of sendmsg return a partial message send if it would block · 210b5664
      Christopher Dykes authored
      Summary: If multiple iovs are passed to sendmsg, sendmsg is supposed to return the number of bytes sent if it would block, but only if the number of bytes sent is greater than 0.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D4099691
      
      fbshipit-source-id: e58fa71604966129b1fbd418c24b1bf012060428
      210b5664