2 * Copyright 2016-present Facebook, Inc.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <folly/CPortability.h>
22 * Calls common init functions in the necessary order
23 * Among other things, this ensures that folly::Singletons are initialized
24 * correctly and installs signal handlers for a superior debugging experience.
25 * It also initializes gflags and glog.
27 * @param argc, argv arguments to your main
28 * @param removeFlags if true, will update argc,argv to remove recognized
29 * gflags passed on the command line
33 void init(int* argc, char*** argv, bool removeFlags = true);
36 * An RAII object to be constructed at the beginning of main() and destructed
37 * implicitly at the end of main().
39 * The constructor performs the same setup as folly::init(), including
40 * initializing singletons managed by folly::Singleton.
42 * The destructor destroys all singletons managed by folly::Singleton, yielding
43 * better shutdown behavior when performed at the end of main(). In particular,
44 * this guarantees that all singletons managed by folly::Singleton are destroyed
45 * before all Meyers singletons are destroyed.
49 // Force ctor & dtor out of line for better stack traces even with LTO.
50 FOLLY_NOINLINE Init(int* argc, char*** argv, bool removeFlags = true);
51 FOLLY_NOINLINE ~Init();