CVSROOT: /cvs Module name: src Changes by: d...@cvs.openbsd.org 2010/08/22 22:49:10
Modified files: sys/kern : kern_workq.c Log message: fix two problems identified by matthew@: 1. though shalt not hold a mutex while sleeping, which kthread_create can do. instead of holding the wq mutex over the kthread_create and increasing the number of running threads after kthread_create succeeds, this counts the thread and drops the mutex before kthread_create. after the call it takes the mutex again and decrements the number of threads if the call failed. 2. if a workq is created during autoconf, the actual thread create is deferred to when the scheduler is running. if the workq is destroyed before then, the wq memory gets freed and then the deferred thread creation will be using freed memory. we now have a workq state variable so we can do the right thing at the different stages of the workqs lifetime. ok matthew@