~ubuntu-branches/ubuntu/oneiric/haxe/oneiric

« back to all changes in this revision

Viewing changes to haxe/std/cpp/vm/Mutex.hx

  • Committer: Bazaar Package Importer
  • Author(s): Jens Peter Secher
  • Date: 2010-01-31 23:08:43 UTC
  • mfrom: (5.2.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100131230843-1cxte2x20ypk9c25
Tags: 1:2.5-1
New upstream version, taken from new upstream subversion repository.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 */
25
25
package cpp.vm;
26
26
 
 
27
#if HXCPP_MULTI_THREADED
 
28
 
27
29
class Mutex {
28
30
        var m : Dynamic;
 
31
 
29
32
        public function new() {
30
 
                m = mutex_create();
 
33
                m = untyped __global__.__hxcpp_mutex_create();
31
34
        }
32
35
        public function acquire() {
33
 
                mutex_acquire(m);
 
36
                untyped __global__.__hxcpp_mutex_acquire(m);
34
37
        }
35
38
        public function tryAcquire() : Bool {
36
 
                return mutex_try(m);
 
39
                return untyped __global__.__hxcpp_mutex_try(m);
37
40
        }
38
41
        public function release() {
39
 
                mutex_release(m);
 
42
                untyped __global__.__hxcpp_mutex_release(m);
40
43
        }
41
 
        static var mutex_create = cpp.Lib.load("std","mutex_create",0);
42
 
        static var mutex_release = cpp.Lib.load("std","mutex_release",1);
43
 
        static var mutex_acquire = cpp.Lib.load("std","mutex_acquire",1);
44
 
        static var mutex_try = cpp.Lib.load("std","mutex_try",1);
45
44
}
 
45
 
 
46
#else
 
47
You_need_to_define_HXCPP_MULTI_THREADED_to_use_the_Mutex_class
 
48
#end