Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

Hi, I've recently tried to make my app run a little smoother while loading embedded resources and i was trying the above mentioned classes. I've tried using the Thread class but when i compile with xcode i get a desyncronization problem ( i think ) - …

Viewing 1 to 10 (10 Total)
Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

gsabiescu

gsabiescu
Total Posts: 4
Joined: February 09, 2012

Hi,

I've recently tried to make my app run a little smoother while loading embedded resources and i was trying the above mentioned classes.
I've tried using the Thread class but when i compile with xcode i get a desyncronization problem ( i think ) - "warning: check_safe_call: could not restore current frame" and everything crashes (this happens only when i repeatedly call the thread method "create").

This is what i've tried :

Thread.create( caller );

private function caller() : Void {
sprite = new TextClass();
}

//// contents of textClass

package;

import nme.display.Sprite;
import nme.media.SoundChannel;
import nme.media.Sound;
import nme.Assets;
import nme.Lib;
import cpp.vm.Mutex;

class TextClass extends Sprite {

public function new() : Void {
super();
trace("test");

}

}

/////

I've never worked with threads so ... i was hoping for a step by step haxe example if anyone has something like this ...

Thanks a bunch grin

Tags:
Posted on February 23, 2012 at 9:51 AM

Huge

Huge
Total Posts: 554
Joined: October 07, 2011

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

Hi,
It is very probably the case that the "DisplayObject" classes are not thread-safe. For example, I do not do any mutex locking when adding stuff to a display list.
However, you should be able to do quite a bit of stuff from a thread.
Perhaps you are running out of thread resources?
You would typically create a single thread for loading resources, and make a queue of jobs for it to do.
But as you suggest, we should get together some sort of best practice for multi-threaded resource loading.

Hugh

Posted on February 23, 2012 at 7:41 PM

Philippe

Philippe
Total Posts: 262
Joined: September 08, 2011

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

How do you synchronize back on the UI thread?

Posted on February 24, 2012 at 2:52 AM

crayfellow

crayfellow
Total Posts: 204
Joined: November 28, 2011

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

I think it would help a ton of developers to have a simple multithread NME example! Thanks for covering this, guys. Do any of you have something we could use as is, or is this something someone would have to create anew?

Patrick

Posted on February 24, 2012 at 10:55 AM

Martamius

Martamius
Total Posts: 13
Joined: March 12, 2012

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

I too would love to see some examples of multithreading in NME, if available.

Posted on March 26, 2012 at 7:25 PM

Nomed

Nomed
Total Posts: 72
Joined: February 07, 2012

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

Guys, multithreading example is indeed much needed for anything tougher than simplest games. And ofc. resource loading...

Posted on March 27, 2012 at 10:49 AM

raould

raould
Total Posts: 224
Joined: December 03, 2011

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

bump smiling i didn't see anything in the samples/ stuff other than the little bit for the android activity.

Posted on July 13, 2012 at 9:23 AM

fezghoul

fezghoul
Total Posts: 1
Joined: July 28, 2012

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

+1 for a multithreading example.

Posted on August 10, 2012 at 9:57 AM

edd

edd
Total Posts: 61
Joined: June 24, 2012

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

Bump. Pretty please... grin

Posted on August 11, 2012 at 11:17 AM

emrahozer

emrahozer
Total Posts: 49
Joined: October 08, 2012

Re: Haxe concurrency ( cpp.vm.Thread, Mutex, Lock ) on IOS

A detailed sample would be awesome. Not only about simple math examples; display, resource related examples would also be really helpfull.

Posted on January 30, 2013 at 7:03 AM