summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2007-12-11 15:04:02 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2007-12-11 15:04:02 +0000
commitf048a7851821a3634b28165845a03b5b0775022a (patch)
tree602c0354be97ae216776a919749d0be4063a4291 /sys
parenta9d778684bf058976c42acaf9d211ec4f7a267b4 (diff)
release the pool mutex if we may sleep in the backend
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/subr_pool.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/sys/kern/subr_pool.c b/sys/kern/subr_pool.c
index bd6f6b43c54..a9ac0c37e75 100644
--- a/sys/kern/subr_pool.c
+++ b/sys/kern/subr_pool.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr_pool.c,v 1.56 2007/12/09 00:24:04 tedu Exp $ */
+/* $OpenBSD: subr_pool.c,v 1.57 2007/12/11 15:04:01 tedu Exp $ */
/* $NetBSD: subr_pool.c,v 1.61 2001/09/26 07:14:56 chs Exp $ */
/*-
@@ -1288,8 +1288,16 @@ struct pool_allocator pool_allocator_nointr = {
void *
pool_allocator_alloc(struct pool *pp, int flags)
{
+ boolean_t waitok = (flags & PR_WAITOK) ? TRUE : FALSE;
+ void *v;
+
+ if (waitok)
+ mtx_leave(&pp->pr_mtx);
+ v = pp->pr_alloc->pa_alloc(pp, flags);
+ if (waitok)
+ mtx_enter(&pp->pr_mtx);
- return (pp->pr_alloc->pa_alloc(pp, flags));
+ return (v);
}
void