blob: 3ff56b8efee19c96c311dd40e60f5a4bc0255b5d [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
James Kuszmaulad8a8082020-02-14 21:21:58 -08008// TODO(james): Clean up/unify the various init functions.
9
Alex Perrycb7da4b2019-08-28 19:35:56 -070010// Initializes glog and gflags.
11void InitGoogle(int *argc, char ***argv);
12
Brian Silverman6da04272014-05-18 18:47:48 -070013// In order to use shared memory, one of the Init* functions must be called in
14// exactly 1 thread per process. It is OK to keep going without calling one of
15// them again after fork(2)ing.
16
brians343bc112013-02-10 01:53:46 +000017// Does the non-realtime parts of the initialization process.
James Kuszmaulad8a8082020-02-14 21:21:58 -080018void InitNRT();
brians343bc112013-02-10 01:53:46 +000019// Initializes everything, including the realtime stuff.
Brian Silvermanf3cfbd72013-10-28 16:26:09 -070020// relative_priority adjusts the priority of this process relative to all of the
21// other ones (positive for higher priority).
22void Init(int relative_priority = 0);
brians343bc112013-02-10 01:53:46 +000023// Same as InitNRT, except will remove an existing shared memory file and create
24// a new one.
25void InitCreate();
26// Cleans up (probably not going to get called very often because few things can
27// exit gracefully).
28void Cleanup();
29
James Kuszmaulad8a8082020-02-14 21:21:58 -080030// Performs the realtime parts of initialization after InitNRT() has been called.
Brian Silverman8f8debf2018-03-11 19:30:23 -070031void GoRT(int relative_priority = 0);
32
Brian Silvermane4d8b282015-12-24 13:44:48 -080033// Pins the current thread to CPU #number.
34void PinCurrentThreadToCPU(int number);
35
brians343bc112013-02-10 01:53:46 +000036} // namespace aos
37
John Park398c74a2018-10-20 21:17:39 -070038#endif // AOS_INIT_H_