purecall in dgThread

A place to discuss everything related to Newton Dynamics.

Moderators: Sascha Willems, walaber

purecall in dgThread

Postby JoeWright2 » Fri Aug 21, 2015 10:30 pm

Hi, got a strange intermittent bug in dgThread::dgThreadSystemCallback at:

Code: Select all
me->Execute(me->m_id);


This can cause a purecall in debug mode (and I presume the cause of a crash I'm having in release mode).

I am recreating the world many times over in short succession (for an optimisation process). The current run I'm doing can have very short simulation times. I'm wondering if there's some overlap problems with the threads, but I don't have expertise in the area.

Is this fundamentally a bug, or should I be configuring things differently? Can I turn off threading?

Thanks, Joe
JoeWright2
 
Posts: 14
Joined: Tue Aug 11, 2015 10:13 am

Re: purecall in dgThread

Postby Julio Jerez » Fri Aug 21, 2015 11:28 pm

you can try uncomment
//#define DG_USE_THREAD_EMULATION

in dgThread.h
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: purecall in dgThread

Postby JoeWright2 » Sat Aug 22, 2015 9:04 am

That worked, thanks.
JoeWright2
 
Posts: 14
Joined: Tue Aug 11, 2015 10:13 am

Re: purecall in dgThread

Postby JoeJ » Sat Aug 22, 2015 4:36 pm

There's this function: NewtonWaitForUpdateToFinish (world),
I call this before changing stuff that may be still in use.
User avatar
JoeJ
 
Posts: 1489
Joined: Tue Dec 21, 2010 6:18 pm

Re: purecall in dgThread

Postby JoeWright2 » Sun Aug 23, 2015 4:23 pm

Hi thanks I tried that, and it certainly did the trick when simulation times were shorter, but still needed Julio's suggestion for short simulations.
JoeWright2
 
Posts: 14
Joined: Tue Aug 11, 2015 10:13 am

Re: purecall in dgThread

Postby Julio Jerez » Sun Aug 23, 2015 6:54 pm

what do you mean by short simulation?>

you I would do is to create a Pool of world, the you can flush a world by calling delete all body, and repopulate again. this will same lot of overhead o create and destroy works whish is not cheap.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles

Re: purecall in dgThread

Postby JoeWright2 » Mon Aug 24, 2015 9:54 am

I wrote that last one in a rush. What I meant to say was that NewtonWaitForUpdateToFinish worked when I was simulating, say, more than a couple of seconds of physical time, but when it was shorter, I ran into the problem of the purecall when simulating a shorter time and recreating the world.

So you would suggest not destroying the world? Just empty it all and recreate bodies?

Joe
JoeWright2
 
Posts: 14
Joined: Tue Aug 11, 2015 10:13 am

Re: purecall in dgThread

Postby Julio Jerez » Mon Aug 24, 2015 10:32 am

JoeWright2 wrote:So you would suggest not destroying the world? Just empty it all and recreate bodies?Joe

yes.
Julio Jerez
Moderator
Moderator
 
Posts: 12426
Joined: Sun Sep 14, 2003 2:18 pm
Location: Los Angeles


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 5 guests