34 lines
652 B
C++
34 lines
652 B
C++
#include "session.h"
|
|
#include "server.h"
|
|
|
|
int main()
|
|
{
|
|
server srv("0.0.0.0", "12345");
|
|
|
|
std::thread t([&]{
|
|
std::this_thread::sleep_for(std::chrono::seconds(10));
|
|
srv.stop();
|
|
});
|
|
t.detach();
|
|
|
|
srv.run();
|
|
std::cout << "after run" << std::endl;
|
|
|
|
/*
|
|
threadpool pool;
|
|
|
|
pool.add_task<void>([]{
|
|
std::this_thread::sleep_for(std::chrono::seconds(5));
|
|
std::cout << "first task completed" << std::endl;
|
|
});
|
|
|
|
pool.add_task<void>([]{
|
|
std::this_thread::sleep_for(std::chrono::seconds(10));
|
|
std::cout << "second task completed" << std::endl;
|
|
});
|
|
|
|
pool.wait_all();
|
|
std::cout << "all tasks completed" << std::endl;
|
|
*/
|
|
return 0;
|
|
} |