Browse Source

hl threads support

Nicolas Cannasse 7 years ago
parent
commit
f13b4e2a36
1 changed files with 12 additions and 0 deletions
  1. 12 0
      std/hl/Gc.hx

+ 12 - 0
std/hl/Gc.hx

@@ -34,6 +34,10 @@ enum GcFlag {
 		Enable allocation tracking
 		Enable allocation tracking
 	**/
 	**/
 	Track;
 	Track;
+	/**
+		Disable GC locking for multithreads
+	**/
+	NoThreads;
 }
 }
 
 
 class Gc {
 class Gc {
@@ -61,6 +65,14 @@ class Gc {
 		_set_flags(v.toInt());
 		_set_flags(v.toInt());
 		return v;
 		return v;
 	}
 	}
+	
+	/**
+		Enter/leave a blocking section: when in a blocking section the thread cannot
+		allocate any memory but other threads will not wait for it for collecting memory.
+	**/
+	@:hlNative("std", "blocking")
+	public static function blocking( b : Bool ) {
+	}
 
 
 	@:hlNative("std", "gc_dump_memory") static function _dump( b : hl.Bytes ) : Void {}
 	@:hlNative("std", "gc_dump_memory") static function _dump( b : hl.Bytes ) : Void {}