Using Pthread on android crashed

Hi I am trying to preload the sounds for my game on a different thread during a loading screen so that it does not make the game freeze. On iPhone this works perfectly and there is no freeze at all. On android however the game crashes. Ill put my code below

        //create a new thread
        pthread_t t1;
        pthread_create( &t1, NULL, function1,NULL);

void * function1(void * argument)
{
    CCLOG("different thread");
    CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("sound_1.wav");
    CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("sound_2.wav");
    CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("sound_3.wav");
    CocosDenshion::SimpleAudioEngine::sharedEngine()->preloadEffect("sound_4.wav");
    return 0;
}

I have never used different threads before and don’t really know what I am doing.
All help is greatly appreciated!

I am having the same issues but trying to download different images using cURL.

By now whithout solution

I think it has something to do with using the NDK. I just used preprocessor directives to allow it to use pthread only on iPhone. I display a loading screen while this is happening so on android it just displays a static loading screen while it is loading the sounds. This might be a solution for you too?

I have similar problem. But without crash - thread function simply not called. (cocos2d-x-2.0.4)

Lochlann Andrews wrote:

I think it has something to do with using the NDK. I just used preprocessor directives to allow it to use pthread only on iPhone. I display a loading screen while this is happening so on android it just displays a static loading screen while it is loading the sounds. This might be a solution for you too?

I’ve been searching for more info about my problem and it’s about this:
bug: http://www.cocos2d-x.org/issues/2449
post: http://www.cocos2d-x.org/forums/6/topics/32466

I will try this and if it’s not working I will use your solution with preprocessor directives