Issue #908 has been updated by tuxillo. Description updated Category set to Documentation Status changed from In Progress to Closed Target version set to 3.8.0
Hi, MSLEEP/TSLEEP conversion is already mentioned in doc/porting_drivers.txt Closing this one. Cheers, Antonio Huete ---------------------------------------- Bug #908: mention msleep() in porting_drivers.txt http://bugs.dragonflybsd.org/issues/908#change-11855 * Author: aoiko * Status: Closed * Priority: Low * Assignee: tuxillo * Category: Documentation * Target version: 3.8.0 ---------------------------------------- Any suggestions on how to make this clearer are welcome. Index: notes/porting_drivers.txt =================================================================== RCS file: /home/aggelos/imports/vcs/dcvs/doc/notes/porting_drivers.txt,v retrieving revision 1.3 diff -u -p -u -r1.3 porting_drivers.txt --- notes/porting_drivers.txt 29 Dec 2007 18:35:59 -0000 1.3 +++ notes/porting_drivers.txt 6 Jan 2008 17:40:24 -0000 @@ -84,6 +84,24 @@ $DragonFly: doc/notes/porting_drivers.tx call is replaced with lockmgr(&my_lock, LK_EXCLUSIVE|LK_NOWAIT); + On occasion, the FreeBSD code will use mtx_sleep() or msleep() + (currently [01/2008], those macros have identical definitions) + in order to release a mutex and sleep without missing any + wakeups that might occur in between. The DragonFly idiom for + this case is to enter a critical section and use tsleep_interlock() + to let threads in other cpus know that we're about to go to + sleep. In our example, you would substitute + + crit_enter(); + tsleep_interlock(ident); + lockmgr(&my_lock, LK_RELEASE); + tsleep(ident, flags, "whatever", timeout); + crit_exit(); + lockmgr(&my_lock, LK_EXCLUSIVE); + + for + msleep(ident, &my_mtx, flags, "whatever", timeout); + As for mtx_assert() calls, translate them like this: mtx_assert(&my_mtx, MA_OWNED) -> KKASSERT(lockstatus(&my_lock, curthread) != 0) -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account