Skip to content

Commit 66d47a5

Browse files
committed
Resume continuation instead of erasing it
1 parent dbd3350 commit 66d47a5

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

examples/benchmarks/input_output/server_client.effekt

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,32 @@ import bytearray
66

77
def main() = {
88
with on[IOError].panic
9-
val listener = listen("127.0.0.1", 8080, 1000);
9+
val listener = listen("127.0.0.1", 8080);
1010
spawn(box {
1111
with on[IOError].panic
1212
accept(listener, box { connection =>
1313
with on[IOError].panic
14-
println("accepted")
1514
val message = "hello world"
1615
var buffer = bytearray::fromString(message)
1716
write(connection, buffer, 0, buffer.size())
1817
close(connection)
1918
})});
2019

21-
println("started")
22-
2320
val results = array::build(10) { i =>
2421
promise(box {
2522
with on[IOError].result
2623
wait(1000)
2724
val connection = connect("127.0.0.1", 8080)
28-
println("connected")
2925
var buffer = bytearray::allocate(4096)
3026
val number = read(connection, buffer, 0, 4096)
3127
close(connection)
32-
println("closed " ++ number.show)
3328
number
3429
})
3530
};
3631

37-
println("spawned")
38-
3932
var total = 0;
4033
results.foreach { number =>
41-
println("awaiting")
4234
total = total + number.await.value
43-
println("awaited")
4435
};
4536

4637
shutdown(listener)

libraries/llvm/io.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,9 @@ void c_tcp_shutdown(Int handle, Stack stack) {
419419

420420
tcp_accept_closure_t* accept_closure = (tcp_accept_closure_t*)uv_handle->data;
421421
if (accept_closure) {
422-
eraseStack(accept_closure->stack);
422+
// TODO what to resume with
423+
// TODO resume last
424+
resume_Int(accept_closure->stack, 0);
423425
erasePositive(accept_closure->handler);
424426
free(accept_closure);
425427
}

0 commit comments

Comments
 (0)