lib: cancel reconnect timer on free
[project/udebug.git] / examples / test-source.uc
1 #!/usr/bin/env ucode
2 let udebug = require("udebug");
3
4 udebug.init("./udebug.sock");
5 let buf = udebug.create_ring({
6 name: "counter",
7 size: 256,
8 entries: 128,
9 });
10
11 if (!buf) {
12 warn(`Failed to create buffer\n`);
13 exit(1);
14 }
15
16 let count = 0;
17 signal('SIGINT', () => exit(0));
18 signal('SIGTERM', () => exit(0));
19 while (true) {
20 buf.add(`count=${count}`);
21 if (count++ > 1000)
22 sleep(1000);
23 }