| 50 | |
| 51 | public: |
| 52 | CEngine(bool Test, const char *pAppname, std::shared_ptr<CFutureLogger> pFutureLogger) : |
| 53 | m_pFutureLogger(std::move(pFutureLogger)) |
| 54 | { |
| 55 | str_copy(m_aAppName, pAppname); |
| 56 | if(!Test) |
| 57 | { |
| 58 | log_info("engine", "running on %s-%s-%s", CONF_FAMILY_STRING, CONF_PLATFORM_STRING, CONF_ARCH_STRING); |
| 59 | log_info("engine", "arch is %s", CONF_ARCH_ENDIAN_STRING); |
| 60 | |
| 61 | char aVersionStr[128]; |
| 62 | if(os_version_str(aVersionStr, sizeof(aVersionStr))) |
| 63 | { |
| 64 | log_info("engine", "operating system version: %s", aVersionStr); |
| 65 | } |
| 66 | |
| 67 | // init the network |
| 68 | net_init(); |
| 69 | CNetBase::Init(); |
| 70 | } |
| 71 | |
| 72 | #if defined(CONF_PLATFORM_EMSCRIPTEN) |
| 73 | // Make sure we don't use more threads than allowed in total (see PTHREAD_POOL_SIZE in Emscripten.toolchain) |
| 74 | // otherwise starting more threads may lead to deadlocks as the threads will simply not start. |
| 75 | const size_t ThreadCount = 4; |
| 76 | #else |
| 77 | const size_t ThreadCount = std::max(4, (int)std::thread::hardware_concurrency()) - 2; |
| 78 | #endif |
| 79 | m_JobPool.Init(ThreadCount); |
| 80 | |
| 81 | m_Logging = false; |
| 82 | } |
| 83 | |
| 84 | ~CEngine() override |
| 85 | { |
nothing calls this directly
no test coverage detected