dev_lock() question

Divacky Roman xdivac02 at stud.fit.vutbr.cz
Thu Sep 29 09:55:45 PDT 2005


Hi,

dev_lock() looks this way:

void
dev_lock(void)
{
	if (!mtx_initialized(&devmtx))
		mtx_init(&devmtx, "cdev", NULL, MTX_DEF);
	mtx_lock(&devmtx);
}

I wonder why is the mtx_initialized checking necessary? shouldnt explicit
initialization be sufficient?

thnx for answer

roman


More information about the freebsd-hackers mailing list