File tree Expand file tree Collapse file tree 2 files changed +4
-11
lines changed
examples/benchmarks/input_output Expand file tree Collapse file tree 2 files changed +4
-11
lines changed Original file line number Diff line number Diff line change @@ -6,41 +6,32 @@ import bytearray
6
6
7
7
def main() = {
8
8
with on[IOError].panic
9
- val listener = listen("127.0.0.1", 8080, 1000 );
9
+ val listener = listen("127.0.0.1", 8080);
10
10
spawn(box {
11
11
with on[IOError].panic
12
12
accept(listener, box { connection =>
13
13
with on[IOError].panic
14
- println("accepted")
15
14
val message = "hello world"
16
15
var buffer = bytearray::fromString(message)
17
16
write(connection, buffer, 0, buffer.size())
18
17
close(connection)
19
18
})});
20
19
21
- println("started")
22
-
23
20
val results = array::build(10) { i =>
24
21
promise(box {
25
22
with on[IOError].result
26
23
wait(1000)
27
24
val connection = connect("127.0.0.1", 8080)
28
- println("connected")
29
25
var buffer = bytearray::allocate(4096)
30
26
val number = read(connection, buffer, 0, 4096)
31
27
close(connection)
32
- println("closed " ++ number.show)
33
28
number
34
29
})
35
30
};
36
31
37
- println("spawned")
38
-
39
32
var total = 0;
40
33
results.foreach { number =>
41
- println("awaiting")
42
34
total = total + number.await.value
43
- println("awaited")
44
35
};
45
36
46
37
shutdown(listener)
Original file line number Diff line number Diff line change @@ -419,7 +419,9 @@ void c_tcp_shutdown(Int handle, Stack stack) {
419
419
420
420
tcp_accept_closure_t * accept_closure = (tcp_accept_closure_t * )uv_handle -> data ;
421
421
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 );
423
425
erasePositive (accept_closure -> handler );
424
426
free (accept_closure );
425
427
}
You can’t perform that action at this time.
0 commit comments