1. 18 Sep, 2015 1 commit
  2. 17 Sep, 2015 2 commits
    • Steve O'Brien's avatar
      folly Singleton: "eager" option to initialize upfront · e4527fb5
      Steve O'Brien authored
      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
      e4527fb5
    • Lucian Grijincu's avatar
      folly: clock: remove static globals, replace with meyers singleton · 2171293f
      Lucian Grijincu authored
      Reviewed By: @yfeldblum
      
      Differential Revision: D2446000
      2171293f
  3. 16 Sep, 2015 6 commits
  4. 15 Sep, 2015 5 commits
    • Lucian Grijincu's avatar
      folly: async: fix SIOF in test · 062f90e9
      Lucian Grijincu authored
      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
      062f90e9
    • Kevin Hurley's avatar
      Add unit test for update_missing · 2b179f9d
      Kevin Hurley authored
      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
      2b179f9d
    • Yedidya Feldblum's avatar
      Prefer constexpr to preprocessor macros in FBString.h · a29c1dfa
      Yedidya Feldblum authored
      Summary: [Folly] Prefer `constexpr` to preprocessor macros in `FBString.h`.
      
      Reviewed By: @JoelMarcey
      
      Differential Revision: D2441709
      a29c1dfa
    • Yedidya Feldblum's avatar
      No need to export global instances of folly::AsciiCase(Ins|S)ensitive · 40673e01
      Yedidya Feldblum authored
      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
      40673e01
    • Yedidya Feldblum's avatar
      Drop support for GCC < 4.8 in folly/FBString.h · b57fd1bc
      Yedidya Feldblum authored
      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
      b57fd1bc
  5. 14 Sep, 2015 10 commits
  6. 13 Sep, 2015 3 commits
  7. 12 Sep, 2015 1 commit
  8. 11 Sep, 2015 7 commits
  9. 10 Sep, 2015 4 commits
    • Mark McDuff's avatar
      use thread_local instead of ThreadLocal for some statics in Random · 6caa3d95
      Mark McDuff authored
      Summary: Exit synchronization is the worst!  The worst!
      
      Reviewed By: @​bmaurer
      
      Differential Revision: D2253073
      6caa3d95
    • Giuseppe Ottaviano's avatar
      Make EliasFanoReader and BitVectorReader API more consistent · 2baf3f69
      Giuseppe Ottaviano authored
      Summary: This diff introduces a few breaking API changes to both EliasFanoReader and BitVectorReader in order to fix some inconsistencies:
      
      - As initalized, `EliasFanoReader` and `BitVectorReader` held a value of `0`, thus if `0` is present in the list `skipTo(0)` would not update the position to `0`, as it happens with any other `skipTo(<first element>)`. This fixes `jumpTo` accordingly.
      - `jump(i + 1)` would go at position `i`. Now `reader.jump(i)`'s postcondition is `reader.position() == i`.
      - It is now illegal to retrieve `value()` from a reader in an out-of-bounds position (before-the-begin or past-the-end). Validity of a reader can be checked with `valid()`.
      
      Reviewed By: @philippv
      
      Differential Revision: D2420023
      2baf3f69
    • Elliott Clark's avatar
      Add SharedPromise<T>::isFulfilled · fc0470a9
      Elliott Clark authored
      Summary: Promise<T> has isFulFilled. This patch adds the corresponding functionality to shared promise.
      
      Reviewed By: @jsedgwick
      
      Differential Revision: D2417631
      fc0470a9
    • Lucian Grijincu's avatar
      folly: small_vector: emplace_back for iterator constructor (compat with std::vector) · 9f9e6d96
      Lucian Grijincu authored
      Summary: This works:
        std::vector<T*> v;
        std::vector<std::unique_ptr<T>> uv(v.begin(), v.end())
      
      Make it work for small_vector as well.
      
      Reviewed By: @ot, @Gownta
      
      Differential Revision: D2426919
      9f9e6d96
  10. 09 Sep, 2015 1 commit