From 412bff1f39c19dbc588d70ac080106215db7eec4 Mon Sep 17 00:00:00 2001 From: pjd Date: Tue, 9 Nov 2004 23:20:50 +0000 Subject: Introduce g_waitidlelock() function which is simlar to g_waitidle(), but should be called with the topology lock held and returns with the topology lock held and empty event queue. Approved by: phk (sometime ago) --- sys/geom/geom.h | 1 + sys/geom/geom_event.c | 12 ++++++++++++ 2 files changed, 13 insertions(+) (limited to 'sys/geom') diff --git a/sys/geom/geom.h b/sys/geom/geom.h index ffdc3cb..3ae296b 100644 --- a/sys/geom/geom.h +++ b/sys/geom/geom.h @@ -213,6 +213,7 @@ int g_post_event(g_event_t *func, void *arg, int flag, ...); int g_waitfor_event(g_event_t *func, void *arg, int flag, ...); void g_cancel_event(void *ref); void g_orphan_provider(struct g_provider *pp, int error); +void g_waitidlelock(void); /* geom_subr.c */ int g_access(struct g_consumer *cp, int nread, int nwrite, int nexcl); diff --git a/sys/geom/geom_event.c b/sys/geom/geom_event.c index 9166c30..f550efc 100644 --- a/sys/geom/geom_event.c +++ b/sys/geom/geom_event.c @@ -90,6 +90,18 @@ g_waitidle(void) } void +g_waitidlelock(void) +{ + + g_topology_assert(); + while (g_pending_events) { + g_topology_unlock(); + tsleep(&g_pending_events, PPAUSE, "g_waitidle", hz/5); + g_topology_lock(); + } +} + +void g_orphan_provider(struct g_provider *pp, int error) { -- cgit v1.1