WvStreams
Main Page
Modules
Classes
Files
File List
File Members
Docs
sgmlmanual
egfiles
wvtimeoutex.cc
1
/*
2
* A WvTimeOut example.
3
*
4
* Should only fire once.
5
*/
6
7
#include "wvtimeoutstream.h"
8
#include "wvlog.h"
9
#include <sys/time.h>
10
11
WvLog
log(
"timeout"
, WvLog::Info);
12
13
void
timeout(
WvStream
&s,
void
*userdata)
14
{
15
static
int
count = 0;
16
count++;
17
log(
"Fire %s\n"
, count);
18
}
19
20
int
main()
21
{
22
WvTimeoutStream
t(1000);
23
t.setcallback(timeout, NULL);
24
25
for
(
int
i = 0; i < 3 && t.isok(); i++)
26
{
27
if
(t.select(-1))
28
t.callback();
29
}
30
31
return
0;
32
}
Generated on Wed Aug 28 2019 23:57:18 for WvStreams by
1.8.3.1