You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- #include <iostream>
-
- #include <ecs/core/utils/fixed_function.inl>
- #include <ecs/core/utils/thread_pool/worker.inl>
-
- using namespace ::ecs::core::utils;
-
- void thread_pool_worker
- ::run()
- {
- _state = state::running;
- while (_state == state::running)
- {
- task t;
- if (pop(t, std::chrono::milliseconds(500)))
- {
- try
- {
- t(_thread_id);
- }
- catch(const std::exception& ex)
- {
- std::cerr << "error in worker thread: " << ex.what() << std::endl;
- }
- catch(...)
- {
- std::cerr << "error in worker thread: unknown" << std::endl;
- }
- }
- }
- _state = state::finished;
- }
|