blob: 85d5da79d2f781ae6571085215adf4780993ff82 [file] [log] [blame]
John Park398c74a2018-10-20 21:17:39 -07001#ifndef AOS_INIT_H_
2#define AOS_INIT_H_
brians343bc112013-02-10 01:53:46 +00003
Brian Silverman2fe007c2014-12-28 12:20:01 -08004#include <string>
5
brians343bc112013-02-10 01:53:46 +00006namespace aos {
7
Alex Perrycb7da4b2019-08-28 19:35:56 -07008// Initializes glog and gflags.
9void InitGoogle(int *argc, char ***argv);
10
Brian Silverman6da04272014-05-18 18:47:48 -070011// In order to use shared memory, one of the Init* functions must be called in
12// exactly 1 thread per process. It is OK to keep going without calling one of
13// them again after fork(2)ing.
14
brians343bc112013-02-10 01:53:46 +000015// Does the non-realtime parts of the initialization process.
Brian Silverman8f8debf2018-03-11 19:30:23 -070016// If for_realtime is true, this sets up to call GoRT later.
17void InitNRT(bool for_realtime = false);
brians343bc112013-02-10 01:53:46 +000018// Initializes everything, including the realtime stuff.
Brian Silvermanf3cfbd72013-10-28 16:26:09 -070019// relative_priority adjusts the priority of this process relative to all of the
20// other ones (positive for higher priority).
21void Init(int relative_priority = 0);
brians343bc112013-02-10 01:53:46 +000022// Same as InitNRT, except will remove an existing shared memory file and create
23// a new one.
24void InitCreate();
25// Cleans up (probably not going to get called very often because few things can
26// exit gracefully).
27void Cleanup();
28
Brian Silverman8f8debf2018-03-11 19:30:23 -070029// Performs the realtime parts of initialization after InitNRT(true) has been called.
30void GoRT(int relative_priority = 0);
31
Brian Silvermane4d8b282015-12-24 13:44:48 -080032// Pins the current thread to CPU #number.
33void PinCurrentThreadToCPU(int number);
34
brians343bc112013-02-10 01:53:46 +000035} // namespace aos
36
John Park398c74a2018-10-20 21:17:39 -070037#endif // AOS_INIT_H_