tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Modules loading modules?



On Mon, 2 Aug 2010, Masao Uebayashi wrote:

    mutex_owned(mtx)

          ...

          mutex_owned() is provided for making diagnostic checks to verify
          that a lock is held.  For example:

                  KASSERT(mutex_owned(&driver_lock));

          It should not be used to make locking decisions at run time, or to
          verify that a lock is not held.

Thus you can't use it for your decision.

Yes, I did read the mutex(9) man page.

However, your assertion is at odds with pooka's suggestion, from
http://mail-index.netbsd.org/tech-kern/2010/08/01/msg008632.html

Good point.  I think it's ok to do:

  if (mutex_owned(mtx))
    cnt++
  else
    lock



-------------------------------------------------------------------------
| Paul Goyette     | PGP Key fingerprint:     | E-mail addresses:       |
| Customer Service | FA29 0E3B 35AF E8AE 6651 | paul at whooppee.com    |
| Network Engineer | 0786 F758 55DE 53BA 7731 | pgoyette at juniper.net |
| Kernel Developer |                          | pgoyette at netbsd.org  |
-------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index