Hi guys,
On:
cocos2d-2.0.0-x-2.0.4
When I invoked SimpleAudioEngine::sharedEngine->playEffect* in my main thread, that’s all right.
But when I invoked it in a new thread created bypthread_create*, it print a log saying that “Failed to find class of org/cocos2dx/lib/Cocos2dxHelper”, and “Fatal signal 11(SIGSEGV) at 0x0000002c (code=1)”.
void StateEngine::startPlay() {
@ SimpleAudioEngine::sharedEngine()->playEffect(“builtin_roles/1/21.ogg”); // that’s all right@
@ pthread_attr_init(&attr);@
@ pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);@
@ pthread_create(&thread, &attr, (void *(*)(void *))&StateEngine::run, this);@
}
void* StateEngine::run(void *params) {
@ SimpleAudioEngine::sharedEngine()->playEffect(“builtin_roles/1/21.ogg”); // error here@
@ // …@
}
Thanks a lot!