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")
|
||||
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);
|
||||
monitor.notifyListeners.add(listener);
|
||||
if (timeout > 0 || nanos > 0) {
|
||||
|
|
|
@ -76,7 +76,7 @@ public class Renderer implements ExprVisitor, StatementVisitor, RenderingContext
|
|||
try {
|
||||
MethodReference monitorEnterRef = new MethodReference(
|
||||
Object.class, "monitorEnter", Object.class, void.class);
|
||||
writer.appendMethodBody(monitorEnterRef).append("(");
|
||||
writer.append("return ").appendMethodBody(monitorEnterRef).append("(");
|
||||
statement.getObjectRef().acceptVisitor(this);
|
||||
writer.append(",").ws();
|
||||
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 {
|
||||
MethodReference asyncRef = getAsyncReference(methodRef);
|
||||
writer.append("var callback").ws().append("=").ws().append("function()").ws().append("{};").softNewLine();
|
||||
writer.append("callback.").appendMethod(completeMethod).ws().append("=").ws().append("function($this,").ws()
|
||||
.append("val)").ws().append("{").indent().softNewLine();
|
||||
writer.append("callback.").appendMethod(completeMethod).ws().append("=").ws().append("function(val)").ws()
|
||||
.append("{").indent().softNewLine();
|
||||
writer.append("return $return($rt_asyncResult(val));").softNewLine();
|
||||
writer.outdent().append("};").softNewLine();
|
||||
writer.append("callback.").appendMethod(errorMethod).ws().append("=").ws().append("function($this,").ws()
|
||||
.append("e)").ws().append("{").indent().softNewLine();
|
||||
writer.append("callback.").appendMethod(errorMethod).ws().append("=").ws().append("function(e)").ws()
|
||||
.append("{").indent().softNewLine();
|
||||
writer.append("return $return($rt_asyncError(e));").softNewLine();
|
||||
writer.outdent().append("};").softNewLine();
|
||||
writer.append("try").ws().append("{").indent().softNewLine();
|
||||
|
|
Loading…
Reference in New Issue
Block a user