Add TimedDrivableExecutor to folly. Summary: Adds a TimedDrivableExecutor implementation of DrivableExecutor that adds a driveUntil method. driveUntil is as drive, except that it takes a timepoint and will stop driving after that time to allow callers to time out more easily. Reviewed By: yfeldblum Differential Revision: D6658320 fbshipit-source-id: a75145748e78497ce107ae152f25729547883835
cmake: remove the check preventing cmake on non-Windows platforms Summary: I believe the CMake build scripts have a similar level of functionality to the autoconf-based build scripts even on Linux these days. This lets users use CMake on Linux and Mac, rather than directing them to autoconf instead. Reviewed By: meyering Differential Revision: D6745366 fbshipit-source-id: 0361eecead55ee06269192eee8d2e7286eb182b8
cmake: mark the compression tests as slow Summary: The compression test code has a large number of parameterized tests that run with a large number of parameter combinations. These tests take many minutes to run. Reviewed By: meyering Differential Revision: D6745364 fbshipit-source-id: dac5d5eb4a786da7be453742fac5f92a9740e468
cmake: enable running the tests Summary: CMake 3.9+ includes built-in support for gtest. This updates the CMake build scripts to make use of this if the GoogleTest module is available. Reviewed By: meyering Differential Revision: D6745369 fbshipit-source-id: 1ef978874b9a0ef2cc5f48ab1c7a0b55d0f1155e
cmake: build as many source files as possible Summary: The CMakeLists.txt file finds the sources and headers for the main folly library by finding all *.cpp and *.h files, and then excluding specific ones. The CMakeLists.txt file was originally written for Windows builds, and it was hard-coded to exclude a number of files that do not build on Windows. This updates the file to properly check for the dependencies, and build these files if their required third-party dependencies are available. Reviewed By: meyering Differential Revision: D6745368 fbshipit-source-id: 3ee04d54147a68c482aab50d30bc9fe2a4134eef
cmake: add more checks for folly-config.h generation Summary: Update the CMake build files to perform additional checks to set configuration macros in folly-config.h I believe this should largely bring the CMake build on-par with (or even better than) the autoconf build scripts. I believe that the CMake build scripts now perform all of the checks necessary to set macros in folly-config.h correctly. The autoconf-based configure script also appears to have a number of bugs: in several places it accidentally uses different macro names than the ones checked in the source code. Some of it's checks are also broken, and fail to detect features correctly due to compilation errors in the check. Reviewed By: yfeldblum Differential Revision: D6735699 fbshipit-source-id: 5ce48f1deddd63c9d52fcccd5d5ccf6ca35e9a0d
cmake: fix the test builds Summary: - Fix the locations of some tests that have been moved. - Remove some tests that have been deleted. - Comment out some tests that depend on parts of folly that are not currently built by the CMake build scripts. - Fix a build error in CompressionTest.cpp if FOLLY_HAVE_LIBZ is not defined. Reviewed By: yfeldblum Differential Revision: D6735700 fbshipit-source-id: 89f60751fa7079b2c609d23d85fbed2a0f317b55
cmake: add checks to generate folly-config.h correctly Summary: Add proper checks to detect and set the values in folly-config.h correctly. Previously the code simply hard-coded values that were appropriate for Windows. This does not yet define all of the settings produced by the autoconf build, but it lets the CMake-based build largely succeed on Linux systems. Reviewed By: meyering Differential Revision: D6710437 fbshipit-source-id: 80490080ee6322995b740ac2a15181d220c6874a
cmake: set compiler flags for non-Windows platforms Summary: Update CMakeLists.txt to check the current platform, and to set compiler flags correctly. It now uses flags for Microsoft Visual Studio on Windows, and flags for gcc or clang on all other platforms. Previously it unconditionally used MSVC flags. Reviewed By: meyering Differential Revision: D6710435 fbshipit-source-id: dbae3097bcadf1ee4a25879dd7770603387c0e4d
cmake: support using a separate build directory Summary: Fix rules in the CMakeLists.txt file that generate source files to first create their output directory if necessary. This allows the build to succeed when building with a separate build output directory, rather than placing build artifacts in the source tree itself. Reviewed By: meyering Differential Revision: D6710436 fbshipit-source-id: 786a65a37a70833e7e4a5affe4df292626dbb591
cmake: fix error message on non-Windows platform Summary: Building folly with cmake is only supported on Windows for now. This fixes cmake on non-Windows platforms to fail with a helpful message telling people to use autoconf. This message was in place before, but was after an MSVC version check preventing it from appearing. Reviewed By: meyering Differential Revision: D6707328 fbshipit-source-id: a28a07ab0da41d605b11d93bba40f33520c5f57e
Move folly/RWSpinLock.h to folly/synchronization/ Summary: [Folly] Move `folly/RWSpinLock.h` to `folly/synchronization/`. Reviewed By: elsteveogrande Differential Revision: D6659265 fbshipit-source-id: 307723e22f42ceb104f26657aed8b34f7e183afb
Move folly/BitIterator.h to folly/container/ Summary: [Folly] Move `folly/BitIterator.h` to `folly/container/`. Reviewed By: djwatson Differential Revision: D6648357 fbshipit-source-id: 5617e3210f58435fcbf3ef07fa745da47dbce475
Add ColdClassTest.cpp to oss builds Summary: [Folly] Add `ColdClassTest.cpp` to oss builds. Reviewed By: spalamarchuk Differential Revision: D6648831 fbshipit-source-id: f8d8a727d63e4e8b83391db454de990027f1bad4
Move folly/Bits.h to folly/lang/ Summary: [Folly] Move `folly/Bits.h` to `folly/lang/`. Reviewed By: phoad, Orvid Differential Revision: D6495547 fbshipit-source-id: a93159321df8277f8a4b4f10a5e4e0fc58cb6022
Move folly/Baton.h to folly/synchronization/ Summary: [Folly] Move `folly/Baton.h` to `folly/synchronization/`. Reviewed By: phoad, Orvid Differential Revision: D6490282 fbshipit-source-id: 66e2d25ffe3275d576b97b81c1987709000f6649
logging: add LoggerDB::updateConfig() and resetConfig() Summary: Add methods for applying config changes from a LogConfig object to the LoggerDB. Reviewed By: bolinfest Differential Revision: D6200564 fbshipit-source-id: a25eb99e84b2885bf6853e2222db0d7432a6c37b
logging: add a FileHandlerFactory class Summary: Add a new LogHandlerFactory interface for creating LogHandler objects from a LogHandlerConfig. Also add an initial FileHandlerFactory implementation capable of creating LogHandler objects that write to a file descriptor. Reviewed By: bolinfest Differential Revision: D6200567 fbshipit-source-id: 14b86fc14ad475223aa4b57d45c40638b48c7594
logging: add a LogConfig class and parsing code Summary: Add a new LogConfig class to represent the current configuration state of the LoggerDB. This also includes code to parse config strings in both JSON and a simpler more human-writable format (intended primarily for use in command line arguments). I generally expect the human-writable format to be used mainly to configure log levels. It also supports configuring log handler details as well, but the format for this data is slightly more cumbersome and will probably be harder for people to easily remember. The parsing code is intentionally kept as part of the 'init' library rather than the core 'logging' library so that other libraries that simply wish to log messages do not need to depend on it. For instance, this would allow the folly JSON library to use the logging library without causing a circular dependency. Reviewed By: bolinfest Differential Revision: D6200560 fbshipit-source-id: e4e3c7f941808251b6c7bcbbdac0210118675fb0
implement to() conversions for std::chrono to timespec/timeval Summary: Add folly::to() conversions to convert between std::chrono::duration or std::chrono::time_point types and struct timespec or struct timeval types. To conform to the behavior of the existing arithmetic-to-arithmetic conversions, this code performs proper overflow checking and throws a `ConversionError` on overflow. This unfortunately does make the code rather complicated compared to a non-checking implementation. Conversions between some unusual duration types is not implemented yet, and will fail at compile time if someone tries to use it. This happens for durations where neither the numerator nor the denominator of the ratio is 1. For instance, 7/13ths of a second. Reviewed By: yfeldblum Differential Revision: D6356700 fbshipit-source-id: 9dce8ab8f32d8c18089f32c7176a8abf3c3f11f7