Questions tagged [folly]

Folly ("Facebook Open Source Library") is a C++ library of relatively low-level components, with very few dependencies, developed by Facebook. It's published under the Apache 2.0 license and is under active development as of November 2015.

folly is a C++ library of relative low-level components, developed by Facebook. It's published under the Apache 2.0 license and is under active development as of November 2015.

Among its feature one can find bit manipulation code snippets, an atomic hash map, Andrei Alexandrescu's ScopeGuard mechanism, and many more.

The library professes to complement the C++ Standard Library and Boost, i.e. avoid duplicate functionality with them.

See the overview of the library, or go to its github root.

68 questions
44
votes
2 answers

Recursive variable declaration

I have just seen this black magic in folly/ManualExecutor.h TimePoint now_ = now_.min(); After I grep'ed the whole library source code, I haven't seen a definition of the variable now_ anywhere else than here. What's happening here? Is this…
FCR
  • 1,103
  • 10
  • 25
15
votes
0 answers

Folly on Windows

Has anybody actually succeeded working with Folly (e.g. fbvector and such) classes on MSVC? I am unable to find any sensible information, for example, it fails to compile for not finding folly-config.h while the only thing I find online is a github…
Pavel Radzivilovsky
  • 18,794
  • 5
  • 57
  • 67
13
votes
5 answers

Error in Pods/RCT-Folly/folly/portability/Time.h and Typedef redefinition with different types ('uint8_t' (aka 'unsigned char') vs 'enum clockid_t')

I'm reviewing the source code of a react native project, but I'm having issues building it. After running the following npm install at the root of the project pod install at the ios folder I got the following message in the terminal: sh: -c: line…
13
votes
2 answers

Lambda lifetime explanation for C++20 coroutines

Folly has a useable library for C++20 style coroutines. In the Readme it claims: IMPORTANT: You need to be very careful about the lifetimes of temporary lambda objects. Invoking a lambda coroutine returns a folly::coro::Task that captures a…
Mike Lui
  • 1,301
  • 10
  • 23
9
votes
1 answer

folly IOThreadPoolExecutor vs CPUThreadPoolExecutor

I'm trying to learn more about the async abstractions used by this codebase I'm working on. I'm reading Folly's documentation for two async executor pools in the library, IOThreadPoolExecutor for io bound tasks, and CPUThreadPoolExecutor for cpu…
Samson Hu
  • 201
  • 1
  • 9
7
votes
1 answer

Are iterators from a concurrent hash map safe?

I am currently using Facebook's concurrent hash map and I am wondering if something like this would be possible: folly::ConcurrentHashMap m; // add some elements const auto it = m.find("a"); // during this time, another…
Michael Smith
  • 1,271
  • 1
  • 8
  • 31
7
votes
2 answers

Visual Studio Compile errors in std library

I'm trying build Facebook folly in Visual Studio 2015 RC loosely following the directions provided here: https://github.com/jbandela/folly/tree/vc11 I'm hopeful that with 2015's expanded C++11 support I may have an easier time than what was possible…
firebush
  • 5,180
  • 4
  • 34
  • 45
6
votes
3 answers

Impact of the prior loop iteration on the execution time of the current iteration

I am trying to measure the performance of concurrent insertion in folly hashmap. A simplified version of a program for such insertion is brought here: #include #include #include #include…
MTMD
  • 1,162
  • 2
  • 11
  • 23
5
votes
1 answer

Why do we need to use folly::fbvector instead of std::vector with allocator which reserve large uncommited area initially?

As known, if we push_back elements to the std::vector<>, and if the whole memory allocated in the vector is occupied, then std::vector<> reserves 2X of current size of memory (allocate new memory with 2X size), resize vector and copy old data to the…
Alex
  • 12,578
  • 15
  • 99
  • 195
4
votes
2 answers

How to avoid warning when using scope guard?

I am using folly scope guard, it is working, but it generates a warning saying that the variable is unused: warning: unused variable ‘g’ [-Wunused-variable] The code: folly::ScopeGuard g = folly::makeGuard([&] {close(sock);}); How to avoid such…
Alex
  • 3,301
  • 4
  • 29
  • 43
3
votes
2 answers

Retrieve objects pointers of different type

Consider I have a bunch pointers to to different objects of different classes class1* obj1; class2* obj2; class3* obj3; and they all have one method getArray() which returns a vector for post processing. if all of these pointers are stored in…
ajax_velu
  • 286
  • 3
  • 16
2
votes
1 answer

React Native, the following build commands failed

I am trying to run the ios version of a react native project and the build fails with the following error: My react native version is 0.66.2 ** BUILD FAILED ** The following build commands failed: CompileC…
Pila
  • 5,460
  • 1
  • 19
  • 30
2
votes
0 answers

Folly hazard pointer implementation incorrect memory barrier?

The folly implementation of hazard pointer could be simplified like this (when the asymmetric memory barrier on Linux is used): Atomic source_ptr; 1. writer/updater: (retire operation) old_ptr = source_ptr.load(); …
sheeper
  • 21
  • 1
2
votes
0 answers

How do I run the tests in the Facebook folly library?

I've downloaded and built the Facebook Folly code on my Ubuntu 20.04.02 system. I built and installed googletest, and made sure to use the CMake flag -DBUILD_TESTS=ON to enable building the tests. But how do I run the tests? I've looked around the…
Chad
  • 1,750
  • 2
  • 16
  • 32
2
votes
0 answers

How does folly future achieve to chain async callbacks?

I read from an Instagram blog that with folly future, you can do: doIO1(io1Input) .then([..](Data io1Result) { return doIO2(io1Result); }) .then([..](Data io2Result){ return doIO3(io2Result); }) .then([..](Data io3Result){ ... }) .onError([](const…
Jerry Feng
  • 275
  • 2
  • 6
1
2 3 4 5