Skip to content

Commit

Permalink
DUMBASS
Browse files Browse the repository at this point in the history
  • Loading branch information
superpowers04 committed Jan 31, 2024
1 parent d20196e commit 69edd18
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions source/se/ThreadedAction.hx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package se;

import sys.thread.Thread;
import se.objects.ToggleLock;

class ThreadedAction{
#if(sys.thread)
var lock:ToggleLock = new ToggleLock();
public function new(func:()->Void){
lock.lock();
Thread.create(function(){
func();
lock.release();
});
}

public function wait(?timeout:Float):Bool{
return lock.wait(timeout);
}
#else
public function new(func:()->Void){
Thread.create(func);
}

public function wait(?timeout:Float):Bool {return true;}
#end
}

0 comments on commit 69edd18

Please sign in to comment.