Beatmup
context_event_listener.h
Go to the documentation of this file.
1 /*
2  Beatmup image and signal processing library
3  Copyright (C) 2019, lnstadrum
4 
5  This program is free software: you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation, either version 3 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU General Public License for more details.
14 
15  You should have received a copy of the GNU General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #include <core/context.h>
20 #include <jni.h>
21 
22 namespace Beatmup {
23 
24  /**
25  * Needed for correct functioning of JNI
26  */
28  private:
29  JavaVM *jvm;
30 
31  public:
32  ContextEventListener(JNIEnv *jenv);
33 
34  void threadCreated(PoolIndex pool);
35 
36  void threadTerminating(PoolIndex pool);
37 
38  void taskFail(PoolIndex pool, Beatmup::AbstractTask &task, const std::exception &ex);
39 
40  void gpuInitFail(PoolIndex pool, const std::exception &ex);
41 
42  bool taskDone(PoolIndex pool, Beatmup::AbstractTask &task, bool aborted);
43  };
44 
45 }
Task: an operation that can be executed by multiple threads in parallel.
Definition: parallelism.h:90
Needed for correct functioning of JNI.
bool taskDone(PoolIndex pool, Beatmup::AbstractTask &task, bool aborted)
Called when a task is successfully finished.
void threadCreated(PoolIndex pool)
Called when a new worker thread is created.
void gpuInitFail(PoolIndex pool, const std::exception &ex)
Called when GPU initialization failed.
void taskFail(PoolIndex pool, Beatmup::AbstractTask &task, const std::exception &ex)
Called when a task fails.
void threadTerminating(PoolIndex pool)
Called when a worker thread finished.
An event listener (bunch of callbacks)
Definition: context.h:72
unsigned char PoolIndex
number of tread pools or a pool index
Definition: parallelism.h:67
JNIEnv * jenv
Beatmup::NNets::InferenceTask * task