本文整理汇总了C++中DatabaseTasks::join方法的典型用法代码示例。如果您正苦于以下问题:C++ DatabaseTasks::join方法的具体用法?C++ DatabaseTasks::join怎么用?C++ DatabaseTasks::join使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DatabaseTasks
的用法示例。
在下文中一共展示了DatabaseTasks::join方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc, char* argv[])
{
// Setup bad allocation handler
std::set_new_handler(badAllocationHandler);
#ifndef _WIN32
// ignore sigpipe...
struct sigaction sigh;
sigh.sa_handler = SIG_IGN;
sigh.sa_flags = 0;
sigemptyset(&sigh.sa_mask);
sigaction(SIGPIPE, &sigh, nullptr);
#endif
ServiceManager servicer;
g_dispatcher.start();
g_scheduler.start();
g_dispatcher.addTask(createTask(std::bind(mainLoader, argc, argv, &servicer)));
g_loaderSignal.wait(g_loaderUniqueLock);
if (servicer.is_running()) {
std::cout << ">> " << g_config.getString(ConfigManager::SERVER_NAME) << " Server Online!" << std::endl << std::endl;
#ifdef _WIN32
SetConsoleCtrlHandler([](DWORD) -> BOOL {
g_dispatcher.addTask(createTask([]() {
g_dispatcher.addTask(createTask(
std::bind(&Game::shutdown, &g_game)
));
g_scheduler.stop();
g_databaseTasks.stop();
g_dispatcher.stop();
}));
ExitThread(0);
}, 1);
#endif
servicer.run();
g_scheduler.join();
g_databaseTasks.join();
g_dispatcher.join();
} else {
std::cout << ">> No services running. The server is NOT online." << std::endl;
g_dispatcher.addTask(createTask([]() {
g_dispatcher.addTask(createTask([]() {
g_scheduler.shutdown();
g_databaseTasks.shutdown();
g_dispatcher.shutdown();
}));
g_scheduler.stop();
g_databaseTasks.stop();
g_dispatcher.stop();
}));
g_scheduler.join();
g_databaseTasks.join();
g_dispatcher.join();
}
return 0;
}