--- src/util/threads-win32.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/src/util/threads-win32.c b/src/util/threads-win32.c index 142aa4f..b44d562 100644 --- a/src/util/threads-win32.c +++ b/src/util/threads-win32.c @@ -1,7 +1,7 @@ /* * threads-win32.c: basic thread synchronization primitives * - * Copyright (C) 2009-2011 Red Hat, Inc. + * Copyright (C) 2009-2012 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -163,12 +163,10 @@ int virCondWait(virCondPtr c, virMutexPtr m) virMutexLock(&c->lock); - if (VIR_REALLOC_N(c->waiters, c->nwaiters + 1) < 0) { + if (VIR_APPEND_ELEMENT_COPY(c->waiters, c->nwaiters, &event) < 0) { virMutexUnlock(&c->lock); return -1; } - c->waiters[c->nwaiters] = event; - c->nwaiters++; virMutexUnlock(&c->lock); @@ -200,14 +198,7 @@ void virCondSignal(virCondPtr c) if (c->nwaiters) { HANDLE event = c->waiters[0]; - if (c->nwaiters > 1) - memmove(c->waiters, - c->waiters + 1, - sizeof(c->waiters[0]) * (c->nwaiters-1)); - if (VIR_REALLOC_N(c->waiters, c->nwaiters - 1) < 0) { - ; - } - c->nwaiters--; + VIR_DELETE_ELEMENT(c->waiters, 0, c->nwaiters); SetEvent(event); } -- 1.7.11.7 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list