/usr/include/wvstreams/wvbellpull.h is in libwvstreams-dev 4.6.1-2build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | /* -*- Mode: C++ -*-
* Worldvisions Weaver Software:
* Copyright (C) 1997-2002 Net Integration Technologies, Inc.
*/
#ifndef __WVBATCHSIGNAL_H
#define __WVBATCHSIGNAL_H
#include <uniconf.h>
#include <wvistreamlist.h>
#include <wvtr1.h>
class WvInvertedStream: public WvStream
{
public:
WvInvertedStream(char *_id):
WvStream()
{
WvIStreamList::globallist.append(this, false, _id);
}
~WvInvertedStream()
{
WvIStreamList::globallist.unlink(this);
}
};
/*
* This class is a functor compatible with UniConfCallback,
* IWvStreamCallback and WvStreamCallback, as well as supporting being
* called with no parameters.
*
* It will turn any number of calls to any of these callbacks into a
* single call to the callback you give to it, which will be sent on
* the next run through the main loop.
*
* Think of it as an elevator button: pressing it a bunch of times has
* no more effect than pressing it once, and while it doesn't do what
* you tell it right away, it will do it soon enough.
*/
class WvBellPull
{
public:
WvBellPull(WvCallback<> _cb):
cb(_cb),
bellpull(new WvInvertedStream("bellpull"))
{
bellpull->setcallback(
WvStreamCallback(this, &WvBellPull::bellpull_cb), NULL);
}
WvBellPull(const WvBellPull& _other):
cb(_other.cb),
bellpull(_other.bellpull)
{
bellpull->addRef();
}
~WvBellPull()
{
bellpull->release();
}
void delay(time_t msec_timeout)
{
bellpull->alarm(msec_timeout);
}
void cancel()
{
bellpull->alarm(-1);
}
void operator()()
{
bellpull->alarm(0);
}
void operator()(IWvStream&)
{
bellpull->alarm(0);
}
void operator()(WvStream&, void*)
{
bellpull->alarm(0);
}
void operator()(const UniConf &, const UniConfKey &)
{
bellpull->alarm(0);
}
private:
WvCallback<> cb;
WvInvertedStream *bellpull;
void bellpull_cb(WvStream&, void*)
{
cb();
}
};
#endif /* __WVBATCHSIGNAL_H */
|