Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


- - - - -

Using AngelScript in Multithreaded Applications


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 jnbrq   Members   -  Reputation: 115

Like
0Likes
Like

Posted 30 December 2013 - 12:34 PM

Hi guys! I'm trying to write a simple GUI-based interpreter for AngelScript to be used in my future projects. It uses multithreading. The multithreading support is provided by wxWidgets. Problem is that even I try to execute just a little piece of code (script), it crashes. My application is programmed to run just one script at once. It's using asIScriptEngine in MyFrame class, so it's not created every script execution session. In each script execution thread, asIScriptContext is created, so the same context is not used for every script execution session. But it's not running sad.png. Help me plz.
My system configuration :
I'm working under x64 Linux environment, my distro is Ubuntu 12.04. I'm using g++ 4.6.3. My GUI toolkit is wxWidgets 2.9.5 . I compiled it my own. My AngelScript version is 2.28.0 . I'm using CodeBlocks IDE. I have rewritten scriptstdstring add-on to work with wxString.

The source code of the application is attached.

Attached Files



Sponsor:

#2 Andreas Jonsson   Moderators   -  Reputation: 3417

Like
0Likes
Like

Posted 30 December 2013 - 04:49 PM

I took a quick look at your code, but I didn't find any immediately evident problem in the code you've written. 

 

Can you provide more information on the crash you experience? Perhaps show the callstack? Have you tried debugging the code to see where exactly the code crashes?


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

#3 jnbrq   Members   -  Reputation: 115

Like
0Likes
Like

Posted 31 December 2013 - 12:43 AM

Yes, of course. According to the output of debugging, it was an crash caused by X Window System. It seems insane, because as I know, wxThread is based on POSIX Threads. Even I make wxalert(wxString &msg) function an empty function, I get similar errors. The crash usually happens when "m_frm->m_scriptcontext->Execute();" is executed. Then I thought that the crash is caused by wxWidgets logging system. Then I commented "wxLog..." lines. But it didn't work. Perhaps the problem is because of my wrong multithreading usage. Could you provide me an application using AngelScript with pthreads ? If it works on my computer, it will show that the problem is caused by wxWidgets. By the way, I modified and used scriptstdstring to work with wxString. Maybe the problem is caused by it. I attach it.

Attached Files



#4 Andreas Jonsson   Moderators   -  Reputation: 3417

Like
0Likes
Like

Posted 31 December 2013 - 07:54 AM

Unfortunately I have no Linux application that uses multithreading. AngelScript itself doesn't create any threads, it only uses pthread_mutex_t and pthread_rwlock_t for critical sections to avoid concurrency problems if the application uses multiple threads when accessing the engine.

 

If you suspect the problem is with the wxThread, why not exchange it for normal pthreads instead and see if that works? Or even eliminate the extra thread altogether just to see if it is a problem with multithreading or something else entirely.


AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS