diff options
author | 2007-12-11 15:04:01 +0000 | |
---|---|---|
committer | 2007-12-11 15:04:01 +0000 | |
commit | 5eebcbc7515347255758c552f50770a1c6e9699d (patch) | |
tree | a51a75eb64110e7fae6ab63e1839ee6bb95e0e0b /sys/kern/subr_pool.c | |
parent | rearrange the page to read better; ok otto henning (diff) | |
download | wireguard-openbsd-5eebcbc7515347255758c552f50770a1c6e9699d.tar.xz wireguard-openbsd-5eebcbc7515347255758c552f50770a1c6e9699d.zip |
release the pool mutex if we may sleep in the backend
Diffstat (limited to 'sys/kern/subr_pool.c')
-rw-r--r-- | sys/kern/subr_pool.c | 12 |
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 |