WvStreams
wvstreamlistex.cc
1/*
2 * A WvPipe example.
3 *
4 * Some text about this example...
5 */
6
7#include <wvpipe.h>
8
9int X = -1;
10// int X = 0;
11// int X = 1000;
12
13int main()
14{
15 const char *argv1[] = { "sh", "-c",
16 "while :; do echo foo; sleep 3; done", NULL };
17 const char *argv2[] = { "sh", "-c",
18 "while :; do echo snorkle; sleep 1; done", NULL };
19
20 WvPipe stream1(argv1[0], argv1, false, true, false);
21 WvPipe stream2(argv2[0], argv2, false, true, false);
22 stream1.autoforward(*wvcon);
23 stream2.autoforward(*wvcon);
24
25 while (stream1.isok() || stream2.isok())
26 {
27 if (stream1.select(X))
28 stream1.callback();
29 if (stream2.select(X))
30 stream2.callback();
31 }
32}
Implementation of a WvPipe stream.