Beatmup
context_event_listener.cpp
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 "context_event_listener.h"
20 #include "log.h"
21 
22 
23 using namespace Beatmup;
24 
26  jenv->GetJavaVM(&jvm);
27 }
28 
29 
31  // thread attaching is performed every time it is actually needed
32 }
33 
34 
36  // thread detaching is done here
37  jvm->DetachCurrentThread();
38 }
39 
40 
41 void ContextEventListener::taskFail(PoolIndex pool, Beatmup::AbstractTask &task, const std::exception &ex) {
42  LOG_E("BEATMUP GLOBAL EVENT: TASK FAILED in pool %d", pool);
43 }
44 
45 
46 void ContextEventListener::gpuInitFail(PoolIndex pool, const std::exception &ex) {
47  LOG_E("BEATMUP GLOBAL EVENT: GPU INITIALIZATION FAILED in pool %d", pool);
48 }
49 
50 
52  return false;
53 }
Task: an operation that can be executed by multiple threads in parallel.
Definition: parallelism.h:90
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.
#define LOG_E(...)
Definition: log.h:24
unsigned char PoolIndex
number of tread pools or a pool index
Definition: parallelism.h:67
JNIEnv * jenv
Beatmup::NNets::InferenceTask * task