stas at 310.ru
Thu Sep 29 10:08:27 PDT 2005
On Thu, Sep 29, 2005 at 06:55:38PM +0200, Divacky Roman wrote:
> dev_lock() looks this way:
> if (!mtx_initialized(&devmtx))
> mtx_init(&devmtx, "cdev", NULL, MTX_DEF);
> I wonder why is the mtx_initialized checking necessary? shouldnt explicit
> initialization be sufficient?
> thnx for answer
Moving "mtx_initialized()" check into mtx_init will decrease speed of other
mutexes initialization. We must check if it's initialized here because of
it's not permiited to pass already initialized mutex to mtx_init().
More information about the freebsd-hackers