I want to load something in background of loading screen(with animations). I am trying to use pthread, but it is not working on android. On windows no problems with it.
I have thread function like this:
static void* ThreadFunction(void *o)
{
CCMessageBox("ThreadFunction", "MainLayer");
return NULL;
}
And create thread like this:
pthread_t thread;
CCMessageBox("pthread_create", "MainLayer");
pthread_create(&thread, NULL, ThreadFunction, 0);
On windows all works fine: i see 2 messages. On android i see only first message("pthread_create").
I tryed to create thread in onEnter
, onClick
, constructor
methods of my layer.
I am using cocos2d-x 2.0.4. Can somebody help me?
Solution is to use CCHttpClient
.