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)
This commit is contained in:
pjd 2004-11-09 23:20:50 +00:00
parent 37a1084115
commit 412bff1f39
2 changed files with 13 additions and 0 deletions

View File

@ -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);

View File

@ -89,6 +89,18 @@ g_waitidle(void)
curthread->td_pflags &= ~TDP_GEOM;
}
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)
{