@@ -21,16 +21,24 @@ string pathBeforeNewLdc;
2121struct Terminal
2222{
2323 import std.stdio ;
24+ import core.sync.mutex ;
25+
2426 arsd.terminal.Terminal* arsdTerminal;
27+ Mutex mtx;
2528 this (arsd.terminal.Terminal* arsdTerminal)
2629 {
2730 this .arsdTerminal = arsdTerminal;
31+ mtx = new Mutex ();
2832 }
2933
30- void color (Color main, Color secondary){if (arsdTerminal) arsdTerminal.color(main, secondary);}
34+ void color (Color main, Color secondary)
35+ {
36+ if (arsdTerminal) synchronized (mtx)
37+ arsdTerminal.color(main, secondary);
38+ }
3139 int cursorY ()
3240 {
33- if (arsdTerminal)
41+ if (arsdTerminal) synchronized (mtx)
3442 {
3543 arsdTerminal.updateCursorPosition();
3644 return arsdTerminal.cursorY;
@@ -39,20 +47,20 @@ struct Terminal
3947 }
4048 string getline (string message)
4149 {
42- if (arsdTerminal) return arsdTerminal.getline(message);
50+ if (arsdTerminal) synchronized (mtx) return arsdTerminal.getline(message);
4351 std.stdio.writeln (" Can't get line with message [" , message, " ]" );
4452 return " " ;
4553 }
46- void moveTo (int x, int y){if (arsdTerminal) arsdTerminal.moveTo(x, y);}
47- void clear (){if (arsdTerminal) arsdTerminal.clear();}
54+ void moveTo (int x, int y){if (arsdTerminal) synchronized (mtx) arsdTerminal.moveTo(x, y);}
55+ void clear (){if (arsdTerminal) synchronized (mtx) arsdTerminal.clear();}
4856 void write (T... )(T args)
4957 {
50- if (arsdTerminal) arsdTerminal.write(args);
58+ if (arsdTerminal) synchronized (mtx) arsdTerminal.write(args);
5159 else std.stdio.write (args);
5260 }
5361 void flush ()
5462 {
55- if (arsdTerminal)
63+ if (arsdTerminal) synchronized (mtx)
5664 {
5765 arsdTerminal.flush();
5866 arsdTerminal.updateCursorPosition();
@@ -65,11 +73,11 @@ struct Terminal
6573 return std.process.wait (pid);
6674 }
6775
68- void hideCursor (){ if (arsdTerminal) arsdTerminal.hideCursor();}
69- void showCursor (){ if (arsdTerminal) arsdTerminal.showCursor();}
76+ void hideCursor (){ if (arsdTerminal) synchronized (mtx) arsdTerminal.hideCursor();}
77+ void showCursor (){ if (arsdTerminal) synchronized (mtx) arsdTerminal.showCursor();}
7078 void clearToEndOfLine ()
7179 {
72- if (arsdTerminal) arsdTerminal.clearToEndOfLine();
80+ if (arsdTerminal) synchronized (mtx) arsdTerminal.clearToEndOfLine();
7381 flush();
7482 }
7583 void clearLine ()
@@ -81,12 +89,14 @@ struct Terminal
8189
8290 void writeln (T... )(T args)
8391 {
84- if (arsdTerminal) arsdTerminal.writeln(args);
92+ if (arsdTerminal) synchronized (mtx) arsdTerminal.writeln(args);
8593 else std.stdio.writeln (args);
8694 }
8795 ~this ()
8896 {
89- if (arsdTerminal) destroy (* arsdTerminal);
97+ showCursor();
98+ if (arsdTerminal) synchronized (mtx) destroy (* arsdTerminal);
99+ mtx = null ;
90100 }
91101}
92102
@@ -146,17 +156,24 @@ struct Choice
146156 bool shouldTime;
147157 string function () updateChoice;
148158 bool scriptOnly;
159+ bool disableSelectedConfigCache;
160+
161+
162+
163+
164+
149165
150166 this (string name,
151167 ChoiceResult function (Choice* self, ref Terminal t, ref RealTimeConsoleInput input, in CompilationOptions opts) onSelected,
152168 bool shouldTime = false ,
153- string function () updateChoice = null , bool scriptOnly = false )
169+ string function () updateChoice = null , bool scriptOnly = false , bool disableSelectedConfigCache = false )
154170 {
155171 this .name = updateChoice ? updateChoice() : name;
156172 this .onSelected = onSelected;
157173 this .shouldTime = shouldTime;
158174 this .updateChoice = updateChoice;
159175 this .scriptOnly = scriptOnly;
176+ this .disableSelectedConfigCache = disableSelectedConfigCache;
160177 }
161178
162179 bool opEquals (ref const Choice other) const
@@ -882,7 +899,7 @@ private ChoiceResult _backFn(Choice* c, ref Terminal t, ref RealTimeConsoleInput
882899}
883900Choice getBackChoice ()
884901{
885- return Choice (" Back" , &_backFn);
902+ return Choice (" Back" , &_backFn, false , null , false , true );
886903}
887904
888905
@@ -1055,9 +1072,17 @@ int waitRedub(ref Terminal t, DubArguments dArgs, out ProjectDetails proj, strin
10551072void inParallel (scope void delegate ()[] args... )
10561073{
10571074 import std.parallelism ;
1058- foreach (action; parallel (args))
1059- action();
10601075
1076+ // version(AArch64)
1077+ // {
1078+ // foreach(action; args)
1079+ // action();
1080+ // }
1081+ // else
1082+ // {
1083+ foreach (action; parallel (args))
1084+ action();
1085+ // }
10611086}
10621087
10631088int waitDub (ref Terminal t, DubArguments dArgs, string copyLinkerFilesTo = null )
0 commit comments