Questions of lock usage in NetBSD kernel code
Jia-Ju Bai <[email protected]> Sat, 24 Jun 2017 09:59:43 +0800
| Newsgroups | gmane.os.netbsd.devel.kernel,gmane.os.netbsd.devel.general,gmane.os.netbsd.devel.smp |
|---|---|
| Message-ID | <[email protected]> |
Hi, I am a freshman in developing NetBSD drivers, and I have a question in lock usage in NetBSD kernel code. I find three kinds of locks which are often used in OpenBSD drivers, namely "adaptive mutex lock", "spin mutex lock" and "rw lock". I want to know which locks can be held when the current thread can sleep. I have read NetBSD man pages: http://netbsd.gw.com/cgi-bin/man-cgi?mutex+9+NetBSD-current http://netbsd.gw.com/cgi-bin/man-cgi?rwlock+9+NetBSD-current I find two points: (1) The "adaptive mutex lock" *can* be used in this situation. (2) The "spin mutex lock" *can not* be used in this situation. But I still have three questions: (1) Are my points right? (2) What about "rw lock"? (3) What about other kinds of locks if they exist? I am looking forward to useful opinions and answers :) Thanks, Jia-Ju Bai