Using threadpool crashes only on Android

Hi there,

I have some code that just runs perfect on iOS and MacOS, but on Android I get a very weird exception. Here the code:

using namespace test;
class Task : public ThreadPoolJob
{
public:
    
    Task() : ThreadPoolJob("Task") {
    }
    
    JobStatus runJob() {
        CSLOG_VERBOSE("Run job")
        return JobStatus::jobHasFinished;
    }
    
private:
    JUCE_LEAK_DETECTOR (Task)
};

// TaskExecutor Implementation
//--------------------------------------------------------------------
#define TIMEOUT 5000
#define THREADS_COUNT 1
TaskExecutor::TaskExecutor() : _pool(THREADS_COUNT) {
    
    CSLOG_VERBOSE("Initialising TaskExecutor")
}
TaskExecutor::~TaskExecutor(){
    _pool.removeAllJobs(true, 2000);
}
void TaskExecutor::execute(bool background) {
    
    CSLOG_VERBOSE("execute(f, " + String(background) + ")");
    
    if (background) {
        
        _pool.addJob(new Task(), true);
    }
    else {
        
        CSLOG_VERBOSE("mheeee");
    }
}
void TaskExecutor::waitForTasks() {
    
    CSLOG_VERBOSE("waitForTasks")
    
    if (_pool.getNumJobs() > 0) {
     
        _pool.waitForJobToFinish(_pool.getJob(_pool.getNumJobs() - 1), TIMEOUT);
    }
    
    CSLOG_VERBOSE("ended: waitForTasks")
}

And here the TaskExecutor.h

#ifndef TEST_TASKEXECUTOR_H_INCLUDED
#define TEST_TASKEXECUTOR_H_INCLUDED
/** Component used to execute tasks either sequentially in the background using a
 *  ThreadPool with only one thread or right away in current thread */
class TaskExecutor
{
public:
    TaskExecutor();
    ~TaskExecutor();
    void execute(bool background);
    void execute();
    void waitForTasks();
private:
    ThreadPool _pool;
};
#endif  // TEST_TASKEXECUTOR_H_INCLUDED

When I just create an instance fo the TaskExecutor I get the following exception:

02-06 12:21:44.722: I/DEBUG(23576): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
02-06 12:21:44.722: I/DEBUG(23576): Build fingerprint: 'google/hammerhead/hammerhead:4.4.2/KOT49H/937116:user/release-keys'
02-06 12:21:44.722: I/DEBUG(23576): Revision: '11'
02-06 12:21:44.722: I/DEBUG(23576): pid: 31576, tid: 31599, name: com.test  >>> com.test <<<
02-06 12:21:44.722: I/DEBUG(23576): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 00000000
02-06 12:21:44.782: I/DEBUG(23576):     r0 00000000  r1 750d8d84  r2 00000000  r3 00000000
02-06 12:21:44.782: I/DEBUG(23576):     r4 750d8dd0  r5 74e1d320  r6 74f1c198  r7 74e1d2b0
02-06 12:21:44.782: I/DEBUG(23576):     r8 74f1c198  r9 74fdb000  sl bef3d2e4  fp 750d8d74
02-06 12:21:44.782: I/DEBUG(23576):     ip 74e1d2b0  sp 750d8d60  lr 74f18a60  pc 74ead7ec  cpsr 400f0010
02-06 12:21:44.782: I/DEBUG(23576):     d0  0000000000000000  d1  0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d2  0000000000000000  d3  0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d4  0000000000000000  d5  0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d6  0000000000000000  d7  4140000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d8  0000000000000000  d9  0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d10 0000000000000000  d11 0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d12 0000000000000000  d13 0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d14 0000000000000000  d15 0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d16 0000000000000000  d17 0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d18 0000000000000000  d19 0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d20 0000000000000000  d21 0000004400000044
02-06 12:21:44.782: I/DEBUG(23576):     d22 0000000000000000  d23 0000000000000000
02-06 12:21:44.782: I/DEBUG(23576):     d24 0000000000000000  d25 0002a7600002a760
02-06 12:21:44.782: I/DEBUG(23576):     d26 0707070703030303  d27 0300000004000000
02-06 12:21:44.782: I/DEBUG(23576):     d28 0800000009000000  d29 0001000000010000
02-06 12:21:44.782: I/DEBUG(23576):     d30 010b400001088000  d31 01108000010e0000
02-06 12:21:44.782: I/DEBUG(23576):     scr 60000010
02-06 12:21:44.782: I/DEBUG(23576): backtrace:
02-06 12:21:44.782: I/DEBUG(23576):     #00  pc 000837ec  /data/app-lib/com.test-2/libtest-java.so (_JavaVM::AttachCurrentThread(_JNIEnv**, void*)+28)
02-06 12:21:44.782: I/DEBUG(23576):     #01  pc 000eea5c  /data/app-lib/com.test-2/libtest-java.so (juce::ThreadLocalJNIEnvHolder::attach()+48)
02-06 12:21:44.782: I/DEBUG(23576):     #02  pc 000f213c  /data/app-lib/com.test-2/libtest-java.so
02-06 12:21:44.782: I/DEBUG(23576):     #03  pc 000f21b0  /data/app-lib/com.test-2/libtest-java.so (threadEntryProc+24)
02-06 12:21:44.782: I/DEBUG(23576): stack:
02-06 12:21:44.782: I/DEBUG(23576):          750d8d20  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d24  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d28  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d2c  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d30  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d34  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d38  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d3c  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d40  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d44  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d48  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d4c  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d50  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d54  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d58  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d5c  00000000  
02-06 12:21:44.782: I/DEBUG(23576):     #00  750d8d60  00000000  
02-06 12:21:44.782: I/DEBUG(23576):          750d8d64  00000000  
02-06 12:21:44.792: I/DEBUG(23576):          750d8d68  750d8d84  [stack:31599]
02-06 12:21:44.792: I/DEBUG(23576):          750d8d6c  00000000  
02-06 12:21:44.792: I/DEBUG(23576):          750d8d70  750d8d8c  [stack:31599]
02-06 12:21:44.792: I/DEBUG(23576):          750d8d74  74f18a60  /data/app-lib/com.test-2/libtest-java.so (juce::ThreadLocalJNIEnvHolder::attach()+52)
02-06 12:21:44.792: I/DEBUG(23576):     #01  750d8d78  00000003  
02-06 12:21:44.792: I/DEBUG(23576):          750d8d7c  74fd4188  /data/app-lib/com.test-2/libtest-java.so
02-06 12:21:44.792: I/DEBUG(23576):          750d8d80  00000000  
02-06 12:21:44.792: I/DEBUG(23576):          750d8d84  00000000  
02-06 12:21:44.792: I/DEBUG(23576):          750d8d88  750d8d9c  [stack:31599]
02-06 12:21:44.792: I/DEBUG(23576):          750d8d8c  74f1c140  /data/app-lib/com.test-2/libtest-java.so
02-06 12:21:44.792: I/DEBUG(23576):     #02  750d8d90  00000000  
02-06 12:21:44.792: I/DEBUG(23576):          750d8d94  750d8dac  [stack:31599]
02-06 12:21:44.792: I/DEBUG(23576):          750d8d98  750d8db4  [stack:31599]
02-06 12:21:44.792: I/DEBUG(23576):          750d8d9c  74f1c1b4  /data/app-lib/com.test-2/libtest-java.so (threadEntryProc+28)
02-06 12:21:44.792: I/DEBUG(23576): memory near r1:
02-06 12:21:44.792: I/DEBUG(23576):     750d8d64 00000000 750d8d84 00000000 750d8d8c  
02-06 12:21:44.792: I/DEBUG(23576):     750d8d74 74f18a60 00000003 74fd4188 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8d84 00000000 750d8d9c 74f1c140 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8d94 750d8dac 750d8db4 74f1c1b4 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8da4 74e1d2b0 74e1d2b0 750d8dd0 400d22ec  
02-06 12:21:44.792: I/DEBUG(23576):     750d8db4 40093174 74e1d2b0 74e1d320 750d8dd0  
02-06 12:21:44.792: I/DEBUG(23576):     750d8dc4 0000000d 00000078 4009330c 750d8dd0  
02-06 12:21:44.792: I/DEBUG(23576):     750d8dd4 74e1d320 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8de4 898ee05a 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8df4 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e04 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e14 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e24 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e34 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e44 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e54 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576): memory near r4:
02-06 12:21:44.792: I/DEBUG(23576):     750d8db0 400d22ec 40093174 74e1d2b0 74e1d320  
02-06 12:21:44.792: I/DEBUG(23576):     750d8dc0 750d8dd0 0000000d 00000078 4009330c  
02-06 12:21:44.792: I/DEBUG(23576):     750d8dd0 750d8dd0 74e1d320 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8de0 00000000 898ee05a 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8df0 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e00 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e10 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e20 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e30 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e40 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e50 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e60 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e70 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e80 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8e90 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     750d8ea0 00000000 00000000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576): memory near r5:
02-06 12:21:44.792: I/DEBUG(23576):     74e1d300 725f6572 6e556e75 65547469 614e7473  
02-06 12:21:44.792: I/DEBUG(23576):     74e1d310 65766974 65726800 003b6461 0000024b  
02-06 12:21:44.792: I/DEBUG(23576):     74e1d320 74cf8568 00000000 00000001 74fdb000  
02-06 12:21:44.792: I/DEBUG(23576):     74e1d330 000fe000 00001000 00000000 00000000  
02-06 12:21:44.792: I/DEBUG(23576):     74e1d340 00007b6f 00000001 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d350 00000000 00000000 750d8dd0 74e14000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d360 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d370 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d380 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d390 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d3a0 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d3b0 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d3c0 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d3d0 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d3e0 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d3f0 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576): memory near r6:
02-06 12:21:44.802: I/DEBUG(23576):     74f1c178 e1a00003 ebfff242 e51b3008 e1a00003  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c188 e24bd004 e8bd8800 000b7b84 fffff9d0  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c198 e92d4800 e28db004 e24dd010 e50b0010  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1a8 e24b3008 e1a00003 ebffffd8 e51b0010  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1b8 ebff6f4d e24b3008 e1a00003 ebffffe3  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1c8 e3a03000 e1a00003 e24bd004 e8bd8800  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1d8 e24b3008 e1a00003 ebffffdc eb01ce90  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1e8 e92d4800 e28db004 e24dd010 e50b0010  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1f8 e59f3084 e08f3003 e51b2010 e3a01000  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c208 e5821008 e3a02000 e50b2008 e24b2008  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c218 e1a00002 e3a01000 e59f2060 e7933002  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c228 e1a02003 e51b3010 ebfe37b7 e1a03000  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c238 e3530000 13a03000 03a03001 e6ef3073  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c248 e3530000 0a00000a e51b3008 e1a00003  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c258 ebfe37b0 e51b3008 e1a02003 e51b3010  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c268 e5832008 e51b3010 e5932008 e51b3010  
02-06 12:21:44.802: I/DEBUG(23576): memory near r7:
02-06 12:21:44.802: I/DEBUG(23576):     74e1d290 0063002f 006d006f 0063002f 006d006f  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d2a0 00630073 0072006f 002f0065 0000004b  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d2b0 74fcfb88 74e13550 74e1d320 74e1d320  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d2c0 7b584001 fffffffe 00000000 00650001  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d2d0 fffffffe 00000000 00690001 00000005  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d2e0 00000000 00000001 bef3d358 6d6f635f  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d2f0 6d6f635f 0000002b 74e1d2b0 6f63536d  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d300 725f6572 6e556e75 65547469 614e7473  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d310 65766974 65726800 003b6461 0000024b  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d320 74cf8568 00000000 00000001 74fdb000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d330 000fe000 00001000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d340 00007b6f 00000001 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d350 00000000 00000000 750d8dd0 74e14000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d360 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d370 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576):     74e1d380 00000000 00000000 00000000 00000000  
02-06 12:21:44.802: I/DEBUG(23576): memory near r8:
02-06 12:21:44.802: I/DEBUG(23576):     74f1c178 e1a00003 ebfff242 e51b3008 e1a00003  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c188 e24bd004 e8bd8800 000b7b84 fffff9d0  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c198 e92d4800 e28db004 e24dd010 e50b0010  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1a8 e24b3008 e1a00003 ebffffd8 e51b0010  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1b8 ebff6f4d e24b3008 e1a00003 ebffffe3  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1c8 e3a03000 e1a00003 e24bd004 e8bd8800  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1d8 e24b3008 e1a00003 ebffffdc eb01ce90  
02-06 12:21:44.802: I/DEBUG(23576):     74f1c1e8 e92d4800 e28db004 e24dd010 e50b0010  
02-06 12:21:44.812: I/DEBUG(23576):     74f1c1f8 e59f3084 e08f3003 e51b2010 e3a01000  
02-06 12:21:44.812: I/DEBUG(23576):     74f1c208 e5821008 e3a02000 e50b2008 e24b2008  
02-06 12:21:44.812: I/DEBUG(23576):     74f1c218 e1a00002 e3a01000 e59f2060 e7933002  
02-06 12:21:44.812: I/DEBUG(23576):     74f1c228 e1a02003 e51b3010 ebfe37b7 e1a03000  
02-06 12:21:44.812: I/DEBUG(23576):     74f1c238 e3530000 13a03000 03a03001 e6ef3073  
02-06 12:21:44.812: I/DEBUG(23576):     74f1c248 e3530000 0a00000a e51b3008 e1a00003  
02-06 12:21:44.812: I/DEBUG(23576):     74f1c258 ebfe37b0 e51b3008 e1a02003 e51b3010  
02-06 12:21:44.812: I/DEBUG(23576):     74f1c268 e5832008 e51b3010 e5932008 e51b3010  
02-06 12:21:44.812: I/DEBUG(23576): memory near r9:
02-06 12:21:44.812: I/DEBUG(23576):     74fdafe0 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdaff0 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb000 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb010 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb020 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb030 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb040 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb050 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb060 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb070 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb080 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb090 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb0a0 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb0b0 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb0c0 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     74fdb0d0 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576): memory near sl:
02-06 12:21:44.812: I/DEBUG(23576):     bef3d2c4 00000002 00000000 001e8480 bef3d2f4  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d2d4 74ef81ec 000001f4 74e1d2b0 bef3d2f4  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d2e4 0468cdb2 74e1d2c0 40071154 bef3d314  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d2f4 74ef82dc 000001f4 74e1d2b0 74e1d2c0  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d304 bef3d364 00000000 74efe76c bef3d32c  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d314 74ef8e40 00000000 bef3d358 ffffffff  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d324 00000000 bef3d33c 74ef8bf0 bef3d34c  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d334 bef3d358 bef3d34c 74eabaf8 400d0000  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d344 bef3d358 bef3d38c 74eab2d8 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d354 bef3d448 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d364 74e1d2f8 00000008 00000001 00636234  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d374 00004000 00000000 00000000 bef30000  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d384 bef3d448 bef3d39c 74efdfe0 bef3d470  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d394 bef3d448 bef3d3ec 74efe664 00cc74bc  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d3a4 00000000 bef3d43c bef3d470 74e13550  
02-06 12:21:44.812: I/DEBUG(23576):     bef3d3b4 74e1d2b8 00000000 00000000 978dd383  
02-06 12:21:44.812: I/DEBUG(23576): memory near fp:
02-06 12:21:44.812: I/DEBUG(23576):     750d8d54 00000000 00000000 00000000 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     750d8d64 00000000 750d8d84 00000000 750d8d8c  
02-06 12:21:44.812: I/DEBUG(23576):     750d8d74 74f18a60 00000003 74fd4188 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     750d8d84 00000000 750d8d9c 74f1c140 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     750d8d94 750d8dac 750d8db4 74f1c1b4 00000000  
02-06 12:21:44.812: I/DEBUG(23576):     750d8da4 74e1d2b0 74e1d2b0 750d8dd0 400d22ec  
02-06 12:21:44.812: I/DEBUG(23576):     750d8db4 40093174 74e1d2b0 74e1d320 750d8dd0  
02-06 12:21:44.812: I/DEBUG(23576):     750d8dc4 0000000d 00000078 4009330c 750d8dd0  
02-06 12:21:44.822: I/DEBUG(23576):     750d8dd4 74e1d320 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8de4 898ee05a 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8df4 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e04 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e14 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e24 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e34 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e44 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576): memory near ip:
02-06 12:21:44.822: I/DEBUG(23576):     74e1d290 0063002f 006d006f 0063002f 006d006f  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d2a0 00630073 0072006f 002f0065 0000004b  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d2b0 74fcfb88 74e13550 74e1d320 74e1d320  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d2c0 7b584001 fffffffe 00000000 00650001  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d2d0 fffffffe 00000000 00690001 00000005  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d2e0 00000000 00000001 bef3d358 6d6f635f  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d2f0 6d6f635f 0000002b 74e1d2b0 6f63536d  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d300 725f6572 6e556e75 65547469 614e7473  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d310 65766974 65726800 003b6461 0000024b  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d320 74cf8568 00000000 00000001 74fdb000  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d330 000fe000 00001000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d340 00007b6f 00000001 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d350 00000000 00000000 750d8dd0 74e14000  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d360 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d370 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     74e1d380 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576): memory near sp:
02-06 12:21:44.822: I/DEBUG(23576):     750d8d40 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8d50 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8d60 00000000 00000000 750d8d84 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8d70 750d8d8c 74f18a60 00000003 74fd4188  
02-06 12:21:44.822: I/DEBUG(23576):     750d8d80 00000000 00000000 750d8d9c 74f1c140  
02-06 12:21:44.822: I/DEBUG(23576):     750d8d90 00000000 750d8dac 750d8db4 74f1c1b4  
02-06 12:21:44.822: I/DEBUG(23576):     750d8da0 00000000 74e1d2b0 74e1d2b0 750d8dd0  
02-06 12:21:44.822: I/DEBUG(23576):     750d8db0 400d22ec 40093174 74e1d2b0 74e1d320  
02-06 12:21:44.822: I/DEBUG(23576):     750d8dc0 750d8dd0 0000000d 00000078 4009330c  
02-06 12:21:44.822: I/DEBUG(23576):     750d8dd0 750d8dd0 74e1d320 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8de0 00000000 898ee05a 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8df0 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e00 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e10 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e20 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576):     750d8e30 00000000 00000000 00000000 00000000  
02-06 12:21:44.822: I/DEBUG(23576): code around pc:
02-06 12:21:44.822: I/DEBUG(23576):     74ead7cc e8bd8800 e92d4800 e28db004 e24dd010  
02-06 12:21:44.822: I/DEBUG(23576):     74ead7dc e50b0008 e50b100c e50b2010 e51b3008  
02-06 12:21:44.822: I/DEBUG(23576):     74ead7ec e5933000 e5933010 e51b0008 e51b100c  
02-06 12:21:44.832: I/DEBUG(23576):     74ead7fc e51b2010 e12fff33 e1a03000 e1a00003  
02-06 12:21:44.832: I/DEBUG(23576):     74ead80c e24bd004 e8bd8800 e92d4800 e28db004  
02-06 12:21:44.832: I/DEBUG(23576):     74ead81c e24dd008 e50b0008 e51b3008 e5933000  
02-06 12:21:44.832: I/DEBUG(23576):     74ead82c e5933014 e51b0008 e12fff33 e1a03000  
02-06 12:21:44.832: I/DEBUG(23576):     74ead83c e1a00003 e24bd004 e8bd8800 e92d4800  
02-06 12:21:44.832: I/DEBUG(23576):     74ead84c e28db004 e24dd008 e50b0008 e50b100c  
02-06 12:21:44.832: I/DEBUG(23576):     74ead85c e51b0008 e51b100c ebfff0f8 e1a03000  
02-06 12:21:44.832: I/DEBUG(23576):     74ead86c e1a00003 e24bd004 e8bd8800 e92d4800  
02-06 12:21:44.832: I/DEBUG(23576):     74ead87c e28db004 e24dd008 e50b0008 e1a03001  
02-06 12:21:44.832: I/DEBUG(23576):     74ead88c e14b30ba e15b30ba e1a03a03 e1a03a23  
02-06 12:21:44.832: I/DEBUG(23576):     74ead89c e6ff3073 e3833a01 e6ff3073 e6ff3073  
02-06 12:21:44.832: I/DEBUG(23576):     74ead8ac e51b0008 e1a01003 e3a02000 ebfff0e6  
02-06 12:21:44.832: I/DEBUG(23576):     74ead8bc e1a03000 e1a00003 e24bd004 e8bd8800  
02-06 12:21:44.832: I/DEBUG(23576): code around lr:
02-06 12:21:44.832: I/DEBUG(23576):     74f18a40 e50b3008 e51b3010 e5932000 e24b3008  
02-06 12:21:44.832: I/DEBUG(23576):     74f18a50 e1a00002 e1a01003 e3a02000 ebfe535b  
02-06 12:21:44.832: I/DEBUG(23576):     74f18a60 e51b3008 e3530000 0a000003 e51b3008  
02-06 12:21:44.832: I/DEBUG(23576):     74f18a70 e51b0010 e1a01003 eb000085 e51b3008  
02-06 12:21:44.832: I/DEBUG(23576):     74f18a80 e1a00003 e24bd004 e8bd8800 e92d4800  
02-06 12:21:44.832: I/DEBUG(23576):     74f18a90 e28db004 e24dd018 e50b0018 e51b3018  
02-06 12:21:44.832: I/DEBUG(23576):     74f18aa0 e5933000 e1a00003 ebfe5359 ebfe4523  
02-06 12:21:44.832: I/DEBUG(23576):     74f18ab0 e1a03000 e50b3008 e51b3018 e2833f41  
02-06 12:21:44.832: I/DEBUG(23576):     74f18ac0 e24b2010 e1a00002 e1a01003 eb004495  
02-06 12:21:44.832: I/DEBUG(23576):     74f18ad0 e3a03000 e50b300c ea000014 e51b1018  
02-06 12:21:44.832: I/DEBUG(23576):     74f18ae0 e51b200c e3a03004 e1a02102 e0812002  
02-06 12:21:44.832: I/DEBUG(23576):     74f18af0 e0823003 e5932000 e51b3008 e1520003  
02-06 12:21:44.832: I/DEBUG(23576):     74f18b00 1a000007 e51b1018 e51b200c e3a03004  
02-06 12:21:44.832: I/DEBUG(23576):     74f18b10 e1a02102 e0812002 e0823003 e3a02000  
02-06 12:21:44.832: I/DEBUG(23576):     74f18b20 e5832000 e51b300c e2833001 e50b300c  
02-06 12:21:44.832: I/DEBUG(23576):     74f18b30 e51b300c e353001f c3a03000 d3a03001  

This is the stack trace parsed:

0x00083cac:_ZN7_JavaVM19AttachCurrentThreadEPP7_JNIEnvPv + 0x001c 

    { return functions->AttachCurrentThread(this, p_env, thr_args); }

0x000ef8d0:_ZN4juce23ThreadLocalJNIEnvHolder6attachEv + 0x0030 

        jvm->AttachCurrentThread (&env, nullptr);

0x000ef8d0:_ZN4juce23ThreadLocalJNIEnvHolder6attachEv + 0x0030 


        if (env != nullptr)

0x000f2fd0:_ZZ15threadEntryProcEN18AndroidThreadScopeC1Ev + 0x0024 

    JUCE_AUTORELEASEPOOL

    {

       #if JUCE_ANDROID

        struct AndroidThreadScope

        {

            AndroidThreadScope()   { threadLocalJNIEnvHolder.attach(); }

0x000f3044:                 threadEntryProc + 0x0018 

        {

            AndroidThreadScope()   { threadLocalJNIEnvHolder.attach(); }

            ~AndroidThreadScope()  { threadLocalJNIEnvHolder.detach(); }

        };


        const AndroidThreadScope androidEnv;

0x000f3044:                 threadEntryProc + 0x0018 

       #endif


        juce_threadEntryPoint (userData);

0x00083cac:_ZN7_JavaVM19AttachCurrentThreadEPP7_JNIEnvPv + 0x001c 

    { return functions->AttachCurrentThread(this, p_env, thr_args); }

0x000ef8d0:_ZN4juce23ThreadLocalJNIEnvHolder6attachEv + 0x0030 

        jvm->AttachCurrentThread (&env, nullptr);

0x000ef8d0:_ZN4juce23ThreadLocalJNIEnvHolder6attachEv + 0x0030 


        if (env != nullptr)

0x000f2fd0:_ZZ15threadEntryProcEN18AndroidThreadScopeC1Ev + 0x0024 

    JUCE_AUTORELEASEPOOL

    {

       #if JUCE_ANDROID

        struct AndroidThreadScope

        {

            AndroidThreadScope()   { threadLocalJNIEnvHolder.attach(); }

0x000f3044:                 threadEntryProc + 0x0018 

        {

            AndroidThreadScope()   { threadLocalJNIEnvHolder.attach(); }

            ~AndroidThreadScope()  { threadLocalJNIEnvHolder.detach(); }

        };


        const AndroidThreadScope androidEnv;

0x000f3044:                 threadEntryProc + 0x0018 

       #endif


        juce_threadEntryPoint (userData);

And on iOS and MacOS it just works fine :(  Can anybody help me?

Must be something in your code, as the thread pool works in the juce demo. What is "CSLOG_VERBOSE"? Is it thread-safe?

CSLOG it is just a macro to print stuff. 

I've created an external project and create an instance in the Main.cpp just jorks

void initialise (const String& commandLine)

    {

        // Add your application's initialisation code here..

        TaskExecutor task;

    }

But if i write my own JNI code it throws me the error, any idea?

Hey,

I got exactly the same problem this morning. You've probably solved this by now, but in case someone else is looking at the same issue:

My Threadpool was part of a global object. So it was created right at the start of the program. This was no problem on Windows and Linux, but android gave me the crash described above.

I turned my global objct into a functor, so now it gets constructed at the moment it is used for the first time. This solved the issue.

In other words, this won't work:

class test {
  ThreadPool x;
};
test Test;

But this does:

class test {
  ThreadPool x;
};

test & Test() {
  static test t;
  return t;
}

Regards,

yvan