Thread pool event listener.
More...
Thread pool event listener.
Definition at line 48 of file context.cpp.
◆ ThreadPoolEventListener()
Beatmup::Context::Impl::ThreadPoolEventListener::ThreadPoolEventListener |
( |
const Context::Impl & |
ctx | ) |
|
|
inline |
Definition at line 53 of file context.cpp.
const Context::Impl & ctx
◆ threadCreated()
void Beatmup::Context::Impl::ThreadPoolEventListener::threadCreated |
( |
PoolIndex |
pool | ) |
|
|
inlinevirtual |
Callback function called when a new worker thread is created.
- Parameters
-
pool | Thread pool number in the context |
Reimplemented from Beatmup::ThreadPool::EventListener.
Definition at line 55 of file context.cpp.
virtual void threadCreated(PoolIndex pool)=0
Called when a new worker thread is created.
Context::EventListener * eventListener
an event listener
◆ threadTerminating()
void Beatmup::Context::Impl::ThreadPoolEventListener::threadTerminating |
( |
PoolIndex |
pool | ) |
|
|
inlinevirtual |
Callback function called when a worker thread is terminating.
- Parameters
-
pool | Thread pool number in the context |
Reimplemented from Beatmup::ThreadPool::EventListener.
Definition at line 60 of file context.cpp.
virtual void threadTerminating(PoolIndex pool)=0
Called when a worker thread finished.
◆ taskDone()
bool Beatmup::Context::Impl::ThreadPoolEventListener::taskDone |
( |
PoolIndex |
pool, |
|
|
AbstractTask & |
task, |
|
|
bool |
aborted |
|
) |
| |
|
inlinevirtual |
Callback function called when a task is done or cancelled; if returns true
, the task will be repeated.
- Parameters
-
pool | Thread pool number in the context |
task | The task |
aborted | If true , the task was aborted |
Reimplemented from Beatmup::ThreadPool::EventListener.
Definition at line 65 of file context.cpp.
virtual bool taskDone(PoolIndex pool, AbstractTask &task, bool aborted)=0
Called when a task is successfully finished.
Beatmup::NNets::InferenceTask * task
◆ taskFail()
void Beatmup::Context::Impl::ThreadPoolEventListener::taskFail |
( |
PoolIndex |
pool, |
|
|
AbstractTask & |
task, |
|
|
std::exception_ptr |
exPtr |
|
) |
| |
|
inlinevirtual |
Callback function called when an exception is thrown.
- Parameters
-
pool | Thread pool number in the context |
task | The task that was running when the exception was thrown |
exPtr | Exception pointer |
Reimplemented from Beatmup::ThreadPool::EventListener.
Definition at line 71 of file context.cpp.
74 std::rethrow_exception(exPtr);
76 catch (
const std::exception & ex) {
77 #if BEATMUP_PLATFORM_ANDROID
78 __android_log_print(ANDROID_LOG_ERROR,
"Beatmup",
79 "\n********************************************\n"
80 "Beatmup engine raises exception:\n%s"
81 "\n********************************************\n", ex.what());
83 std::cout << ex.what() << std::endl;
virtual void taskFail(PoolIndex pool, AbstractTask &task, const std::exception &ex)=0
Called when a task fails.
◆ gpuInitFail()
void Beatmup::Context::Impl::ThreadPoolEventListener::gpuInitFail |
( |
PoolIndex |
pool, |
|
|
std::exception_ptr |
exPtr |
|
) |
| |
|
inlinevirtual |
Callback function called when the GPU cannot start.
- Parameters
-
pool | Thread pool number in the context |
exPtr | Exception pointer; points to the exception instance occurred when starting up the GPU |
Reimplemented from Beatmup::ThreadPool::EventListener.
Definition at line 89 of file context.cpp.
92 std::rethrow_exception(exPtr);
94 catch (
const std::exception & ex) {
95 #if BEATMUP_PLATFORM_ANDROID
96 __android_log_print(ANDROID_LOG_ERROR,
"Beatmup",
97 "\n********************************************\n"
98 "Beatmup engine was unable to init GPU:\n%s"
99 "\n********************************************\n", ex.what());
101 std::cout << ex.what() << std::endl;
virtual void gpuInitFail(PoolIndex pool, const std::exception &ex)=0
Called when GPU initialization failed.
◆ ctx
const Context::Impl& Beatmup::Context::Impl::ThreadPoolEventListener::ctx |
|
private |
The documentation for this class was generated from the following file: