GameMonkey Script

GameMonkey Script Forums
It is currently Tue Jun 18, 2019 3:45 pm

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Mar 16, 2011 7:17 am 
Offline

Joined: Tue Nov 08, 2005 6:47 am
Posts: 5
I have been using Gamemonkey for some years now. It is used as a layer between our application and different types of hardware. The different scripts hides the hardware differences for the main application. This works very well and has simplified system design.

But now we want to use GM for more advanced tasks with threads and states.

When I call machine->Execute(dt) I get an assert at line 199 (GM_ASSERT(m_frame);) in gmThread.cpp.

This happens after I have loaded and run any of our old scripts. They are called with gmCall helper class for each cycle.
If I just run a script like the one below (without calling any old script) it works as expected.

global testthread = function()
{
a = Vector3(1,3,7);
for(;;)
{
yield();
print("Thread",a.x,a.y,a.z);
}
};

thread(testthread);


So do anyone have an idea what can cause GM to not have a stack?

Regards
Thor Henning Amdahl


Top
 Profile  
Reply with quote  
PostPosted: Wed Mar 16, 2011 9:44 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 708
Sorry thorha, nothing springs to mind as to what is going wrong.
We might need to know more about how you are using GM.

What do you mean by 'old scripts'?
Are you saying that a piece of code runs fine BUT if you run some other code first, then that same piece of code fails?

Can you do the usual thing of stripping away code to get the minimal reproducible issue?
Have you checked for memory stompage from other code?
Is it a simple setup, with a single machine running on a single OS thread?
Do you have C/C++ owned gmObjects that are being managed in some way?
What happens when you force the garbage collector to run continuously?
If you are familiar enough with GM, or are game, try tracing the code and see what happened to the stack frame for the thread being executed. Was that thread killed in some unexpected manner?


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 17, 2011 7:39 am 
Offline

Joined: Tue Nov 08, 2005 6:47 am
Posts: 5
Thank you for quick response!

I will try all the things you suggest, but it will take some time to do it.

The setup is a single machine, but it is run in multiple OS threads. Loading gm code and running Execute is done in different OS threads, but the machine is protected by a mutex.

Do you think this could be the cause of my problems?


Best regards
Thor Henning Amdahl


Top
 Profile  
Reply with quote  
PostPosted: Thu Mar 17, 2011 11:41 am 
Offline

Joined: Mon Dec 15, 2003 1:38 pm
Posts: 708
thorha wrote:
...The setup is a single machine, but it is run in multiple OS threads. Loading gm code and running Execute is done in different OS threads, but the machine is protected by a mutex....

GM is not thread safe so this does sound like a potential cause. The only safe way I have used GM with multiple threads is to run different instances in different threads and not access any gm objects between those threads (effectively independent VMs). It also required a mutex on the GM compiler as that part is not thread safe (static or global variables present in the lexer I recall).


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group