Problem with multithreading
Posted: Thu May 24, 2007 1:14 pm
Hi i'm trying to get two "physics worlds" to run in two different POSIX threads. It all works when i disable one of the threads, but when i enable both and they have both reached:
the program crashes with the following error:
My thread spawning function look like this:
I run the application without the openGL part, why I'm only interrested in the results of the physics tests. The reason for me to do this multithreading is to exploit both kernels on multiprocessor systems. The two physics enviroment (including bullet with use of GIMPACT) is supposed to be created in two completely different instances, but it seems like the two threads are sharing something? Why else would they crash only when they're both executing? Can anybody help? Don't really know what to conclude from the error.
Btw. the stacksize of the threads has been set to be large enough to room the instances.
Thx - Jonas
dynamicsWorld->stepSimulation(stepSize)
the program crashes with the following error:
The application is built on the DemoApplication class, from the bullet demos, like this:Bullet/Source/bullet-2.46/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h:95: failed assertion `index < m_cachedPoints'
Code: Select all
class JJ_App : public DemoApplicationCode: Select all
void *spawnThread(void* arg)
{
JJ_App* appInstance = NULL;
char filename[50];
switch((int) arg)
{
case 1:
printf("Thread 1 says Hello\n");
myJJ_App1 = new JJ_App();
appInstance = myJJ_App1;
strcpy(filename,"testResult1.jjres");
break;
case 2:
printf("Thread 2 says Hello\n");
myJJ_App2 = new JJ_App();
appInstance = myJJ_App2;
strcpy(filename,"testResult2.jjres");
break;
default:
printf("ARRRRGH :)\n");
break;
}
appInstance->initPhysics();
appInstance->initTest( (int) arg,0.5f,0.5f,PI/4.0f,0.021227f,filename);
appInstance->threadLoop(); //including stepSimulation() and test analysis
return NULL;
}
Btw. the stacksize of the threads has been set to be large enough to room the instances.
Thx - Jonas