Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize tracing terminal in sys. #3414

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions source/funkin/util/logging/AnsiTrace.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
package funkin.util.logging;

#if (sys && target.threaded)
import sys.thread.Mutex;
#end

class AnsiTrace
{
#if (sys && target.threaded && !TREMOVE)
static final _mutex:Mutex = new Mutex();
#end

// mostly a copy of haxe.Log.trace()
// but adds nice cute ANSI things
public static function trace(v:Dynamic, ?info:haxe.PosInfos)
Expand All @@ -15,7 +23,13 @@ class AnsiTrace
#elseif lua
untyped __define_feature__("use._hx_print", _hx_print(str));
#elseif sys
#if target.threaded
_mutex.acquire();
Sys.println(str);
_mutex.release();
#else
Sys.println(str);
#end
#else
throw new haxe.exceptions.NotImplementedException()
#end
Expand Down