Date: Wed, 17 Jan 2001 11:41:58 -0800 (PST) From: John Baldwin <jhb@FreeBSD.org> To: Alfred Perlstein <bright@wintelcom.net> Cc: arch@FreeBSD.org, Matt Dillon <dillon@earth.backplane.com> Subject: Re: HEADS-UP: await/asleep removal imminent Message-ID: <XFMail.010117114158.jhb@FreeBSD.org> In-Reply-To: <20010117112850.X7240@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
On 17-Jan-01 Alfred Perlstein wrote: > > Jason Evans just added his conditional variables, you could change > asleep/await into cv_attach/cv_await or something, that would give > you less contention on the sleep/run queues, but you'd still need > a spinlock or mutex on these variables. A condvar already contains the state information that asleep() caches in p_aleep right now, so just passing condvar pointers around would accomplish this task using an existing API and is conceptually cleaner: int my_lowlevel_func(struct cv **cv) { if (bad_things) { *cv = &my_condition; return (some_error); } *cv = NULL; return (0); } ... struct cv *cv; ... if (my_lowlevel_func(&cv) != 0) { KASSERT(cv != NULL, (__FUNCTION__ ": nothing to sleep on!")); cv_wait(cv); } -- John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/ PGP Key: http://www.baldwin.cx/~john/pgpkey.asc "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/ To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010117114158.jhb>