Jump to content
  • Advertisement
Sign in to follow this  
Canberk S

Using AngelScript in Multithreaded Applications

This topic is 1727 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!