On 2017/6/23 23:59, Ted Unangst wrote:

Jia-Ju Bai wrote:
Hi,

I am a freshman in developing OpenBSD drivers, and I have a question in
lock usage in OpenBSD kernel code.

I only find two kinds of locks which are often used in OpenBSD drivers,
namely "mutex lock" and "rw lock". I want to know which lock can be held
when the current thread can sleep.

  From my knowledge of OpenBSD document, I only find that "mutex lock"
can not be used in this situation. So I have two questions"
(1) What about "rw lock"?
(2) What about other kinds of locks?
you're on the right track. the rw_init and mtx_init man pages go into this in
more detail and explain the various other options as well.

Thanks for reply.

I have read the man pages of "rw_init":
    http://man.openbsd.org/OpenBSD-5.8/rwlock.9

But I can not ensure whether the thread can sleep when it holds a "rw lock" ....
Could you please give me an explicit answer? Thanks in advance :)


Thanks,
Jia-Ju Bai

Reply via email to