Skip to content

Commit 3c92490

Browse files
authored
use HH\Asio\usleep() instead of usleep
1 parent 5c11ca2 commit 3c92490

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

examples/hack/count.hh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
use namespace HH\Lib\Str;
55
use function HH\Lib\Experimental\IO\request_output;
6-
use function usleep;
76

87
// Simple example script that counts to 10 at ~2Hz, then stops.
98

@@ -14,13 +13,12 @@ async function count_to_ten(): Awaitable<noreturn> {
1413
await $output->writeAsync(
1514
Str\format("%d\n",$count)
1615
);
17-
18-
// usleep is builtin, it is not an async builtin - so it also must block the main request thread
19-
usleep(500000);
16+
17+
HH\Asio\usleep(500000);
2018
}
21-
19+
2220
// flush output
2321
await $output->flushAsync();
24-
22+
2523
exit(0);
2624
}

0 commit comments

Comments
 (0)