Merge commit 'origin/master'
[versaplex.git] / vxodbc / wvdbusd.cc
blobf8caeca13a6a4635d471390f4c98a65ebe3e630a
1 #include "wvdbusserver.h"
2 #include "wvlogstream.h"
3 #include "wvassert.h"
4 #include "wvlinkerhack.h"
6 WV_LINK_TO(WvSSLStream);
7 WV_LINK_TO(WvTCPListener);
8 WV_LINK_TO(WvGzipStream);
9 #ifndef __WIN32
10 WV_LINK_TO(WvUnixListener);
11 #endif
13 static WvLogStream *logr;
14 static WvDBusServer *s;
16 extern "C" void wvdbusd_start()
18 wvassert(!s);
19 wverr->addRef();
20 logr = new WvLogStream(wverr, WvLog::Info);
21 s = new WvDBusServer();
24 extern "C" void wvdbusd_stop()
26 WVRELEASE(s);
27 delete logr;
28 s = NULL;
29 logr = NULL;
32 extern "C" void wvdbusd_listen(const char *moniker)
34 s->listen(moniker);
37 extern "C" void wvdbusd_runonce()
39 // FIXME: Should use runonce(-1) here, but then the .net thread we
40 // run in won't be able to get interrupted to check want_to_die.
41 // Ideally we'd hand them a socket or something that they can ping us
42 // with.
43 s->runonce(1000);
46 extern "C" int wvdbusd_check()
48 return 42;