vhost-user-test: fix g_cond_wait_until compat implementation

This fixes compilation with glib versions up to 2.30, such
as the one in CentOS 6.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2016-06-28 18:32:42 +02:00
parent 66f37d360b
commit 634d39b4e3
2 changed files with 28 additions and 15 deletions

View file

@ -127,25 +127,12 @@ typedef struct TestServer {
int fds_num;
int fds[VHOST_MEMORY_MAX_NREGIONS];
VhostUserMemory memory;
GMutex data_mutex;
GCond data_cond;
CompatGMutex data_mutex;
CompatGCond data_cond;
int log_fd;
uint64_t rings;
} TestServer;
#if !GLIB_CHECK_VERSION(2, 32, 0)
static gboolean g_cond_wait_until(CompatGCond cond, CompatGMutex mutex,
gint64 end_time)
{
gboolean ret = FALSE;
end_time -= g_get_monotonic_time();
GTimeVal time = { end_time / G_TIME_SPAN_SECOND,
end_time % G_TIME_SPAN_SECOND };
ret = g_cond_timed_wait(cond, mutex, &time);
return ret;
}
#endif
static const char *tmpfs;
static const char *root;