00001
00002
00003
00004
00005
00006
00007 #include "wvtimeoutstream.h"
00008 #include "wvlog.h"
00009 #include <sys/time.h>
00010
00011 WvLog log("timeout", WvLog::Info);
00012
00013 void timeout(WvStream &s, void *userdata)
00014 {
00015 static int count = 0;
00016 count++;
00017 log("Fire %s\n", count);
00018 }
00019
00020 int main()
00021 {
00022 WvTimeoutStream t(1000);
00023 t.setcallback(timeout, NULL);
00024
00025 for (int i = 0; i < 3 && t.isok(); i++)
00026 {
00027 if (t.select(-1))
00028 t.callback();
00029 }
00030
00031 return 0;
00032 }