mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-20 07:59:00 +00:00
event: add API for requiring an event loop impl to be registered
Reviewed-by: Cole Robinson <crobinso@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
cccc3fc1bb
commit
2e07a1e146
@ -240,6 +240,7 @@
|
|||||||
@SRCDIR@/src/util/virdnsmasq.c
|
@SRCDIR@/src/util/virdnsmasq.c
|
||||||
@SRCDIR@/src/util/virerror.c
|
@SRCDIR@/src/util/virerror.c
|
||||||
@SRCDIR@/src/util/virerror.h
|
@SRCDIR@/src/util/virerror.h
|
||||||
|
@SRCDIR@/src/util/virevent.c
|
||||||
@SRCDIR@/src/util/vireventpoll.c
|
@SRCDIR@/src/util/vireventpoll.c
|
||||||
@SRCDIR@/src/util/virfcp.c
|
@SRCDIR@/src/util/virfcp.c
|
||||||
@SRCDIR@/src/util/virfdstream.c
|
@SRCDIR@/src/util/virfdstream.c
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "virlog.h"
|
#include "virlog.h"
|
||||||
#include "virerror.h"
|
#include "virerror.h"
|
||||||
|
|
||||||
|
#define VIR_FROM_THIS VIR_FROM_EVENT
|
||||||
|
|
||||||
VIR_LOG_INIT("util.event");
|
VIR_LOG_INIT("util.event");
|
||||||
|
|
||||||
@ -251,6 +252,27 @@ void virEventRegisterImpl(virEventAddHandleFunc addHandle,
|
|||||||
removeTimeoutImpl = removeTimeout;
|
removeTimeoutImpl = removeTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* virEventRequireImpl:
|
||||||
|
*
|
||||||
|
* Require that there is an event loop implementation
|
||||||
|
* registered.
|
||||||
|
*
|
||||||
|
* Returns: -1 if no event loop is registered, 0 otherwise
|
||||||
|
*/
|
||||||
|
int virEventRequireImpl(void)
|
||||||
|
{
|
||||||
|
if (!addHandleImpl || !addTimeoutImpl) {
|
||||||
|
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
|
||||||
|
_("An event loop implementation must be registered"));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* virEventRegisterDefaultImpl:
|
* virEventRegisterDefaultImpl:
|
||||||
*
|
*
|
||||||
@ -276,6 +298,8 @@ int virEventRegisterDefaultImpl(void)
|
|||||||
{
|
{
|
||||||
VIR_DEBUG("registering default event implementation");
|
VIR_DEBUG("registering default event implementation");
|
||||||
|
|
||||||
|
virInitialize();
|
||||||
|
|
||||||
virResetLastError();
|
virResetLastError();
|
||||||
|
|
||||||
if (virEventPollInit() < 0) {
|
if (virEventPollInit() < 0) {
|
||||||
|
@ -21,3 +21,5 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
|
int virEventRequireImpl(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user