Alex Perry | cb7da4b | 2019-08-28 19:35:56 -0700 | [diff] [blame] | 1 | #ifndef AOS_REALTIME_H_ |
| 2 | #define AOS_REALTIME_H_ |
| 3 | |
| 4 | #include <string> |
| 5 | |
| 6 | namespace aos { |
| 7 | |
| 8 | // Locks everything into memory and sets the limits. This plus InitNRT are |
| 9 | // everything you need to do before SetCurrentThreadRealtimePriority will make |
| 10 | // your thread RT. Called as part of ShmEventLoop::Run() |
| 11 | void InitRT(); |
| 12 | |
| 13 | // Sets the current thread back down to non-realtime priority. |
| 14 | void UnsetCurrentThreadRealtimePriority(); |
| 15 | |
| 16 | // Sets the name of the current thread. |
| 17 | // This will displayed by `top -H`, dump_rtprio, and show up in logs. |
| 18 | // name can have a maximum of 16 characters. |
| 19 | void SetCurrentThreadName(const ::std::string &name); |
| 20 | |
| 21 | // Sets the current thread's realtime priority. |
| 22 | void SetCurrentThreadRealtimePriority(int priority); |
| 23 | |
| 24 | // Sets up this process to write core dump files. |
| 25 | // This is called by Init*, but it's here for other files that want this |
| 26 | // behavior without calling Init*. |
| 27 | void WriteCoreDumps(); |
| 28 | |
| 29 | void LockAllMemory(); |
| 30 | |
| 31 | } // namespace aos |
| 32 | |
| 33 | #endif // AOS_REALTIME_H_ |