mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -08:00
Bugfixes in sync primitives
This commit is contained in:
parent
0c5fb8d9b0
commit
7d62c16c8d
|
@ -216,6 +216,9 @@ public class TObject {
|
||||||
|
|
||||||
@Rename("wait")
|
@Rename("wait")
|
||||||
public final void wait0(long timeout, int nanos, final AsyncCallback<Void> callback) {
|
public final void wait0(long timeout, int nanos, final AsyncCallback<Void> callback) {
|
||||||
|
if (!holdsLock(this)) {
|
||||||
|
throw new TIllegalMonitorStateException();
|
||||||
|
}
|
||||||
final NotifyListenerImpl listener = new NotifyListenerImpl(this, callback, monitor.count);
|
final NotifyListenerImpl listener = new NotifyListenerImpl(this, callback, monitor.count);
|
||||||
monitor.notifyListeners.add(listener);
|
monitor.notifyListeners.add(listener);
|
||||||
if (timeout > 0 || nanos > 0) {
|
if (timeout > 0 || nanos > 0) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
||||||
try {
|
try {
|
||||||
MethodReference monitorEnterRef = new MethodReference(
|
MethodReference monitorEnterRef = new MethodReference(
|
||||||
Object.class, "monitorEnter", Object.class, void.class);
|
Object.class, "monitorEnter", Object.class, void.class);
|
||||||
writer.appendMethodBody(monitorEnterRef).append("(");
|
writer.append("return ").appendMethodBody(monitorEnterRef).append("(");
|
||||||
statement.getObjectRef().acceptVisitor(this);
|
statement.getObjectRef().acceptVisitor(this);
|
||||||
writer.append(",").ws();
|
writer.append(",").ws();
|
||||||
writer.append("$rt_continue($part_").append(statement.getAsyncTarget()).append(')');
|
writer.append("$rt_continue($part_").append(statement.getAsyncTarget()).append(')');
|
||||||
|
|
|
@ -39,12 +39,12 @@ public class AsyncMethodGenerator implements Generator, DependencyPlugin {
|
||||||
public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException {
|
public void generate(GeneratorContext context, SourceWriter writer, MethodReference methodRef) throws IOException {
|
||||||
MethodReference asyncRef = getAsyncReference(methodRef);
|
MethodReference asyncRef = getAsyncReference(methodRef);
|
||||||
writer.append("var callback").ws().append("=").ws().append("function()").ws().append("{};").softNewLine();
|
writer.append("var callback").ws().append("=").ws().append("function()").ws().append("{};").softNewLine();
|
||||||
writer.append("callback.").appendMethod(completeMethod).ws().append("=").ws().append("function($this,").ws()
|
writer.append("callback.").appendMethod(completeMethod).ws().append("=").ws().append("function(val)").ws()
|
||||||
.append("val)").ws().append("{").indent().softNewLine();
|
.append("{").indent().softNewLine();
|
||||||
writer.append("return $return($rt_asyncResult(val));").softNewLine();
|
writer.append("return $return($rt_asyncResult(val));").softNewLine();
|
||||||
writer.outdent().append("};").softNewLine();
|
writer.outdent().append("};").softNewLine();
|
||||||
writer.append("callback.").appendMethod(errorMethod).ws().append("=").ws().append("function($this,").ws()
|
writer.append("callback.").appendMethod(errorMethod).ws().append("=").ws().append("function(e)").ws()
|
||||||
.append("e)").ws().append("{").indent().softNewLine();
|
.append("{").indent().softNewLine();
|
||||||
writer.append("return $return($rt_asyncError(e));").softNewLine();
|
writer.append("return $return($rt_asyncError(e));").softNewLine();
|
||||||
writer.outdent().append("};").softNewLine();
|
writer.outdent().append("};").softNewLine();
|
||||||
writer.append("try").ws().append("{").indent().softNewLine();
|
writer.append("try").ws().append("{").indent().softNewLine();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user