Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Nov 2000 19:25:27 -0800
From:      Mike Smith <msmith@freebsd.org>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys eventhandler.h 
Message-ID:  <200011150325.eAF3PRF01212@mass.osd.bsdi.com>
In-Reply-To: Your message of "Tue, 14 Nov 2000 10:23:00 PST." <200011141823.KAA89218@freefall.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> jhb         2000/11/14 10:23:00 PST
> 
>   Modified files:
>     sys/sys              eventhandler.h 
>   Log:
>   Only hold the mutex for an eventhandler list while the list is being accessed.
>   Specifically, don't hold the lock while calling event handlers as a handler
>   may tsleep() while holding the mutex.

This is wrong and should be backed out; the tsleep() in the handler is 
the bug.  You can't release the lock on the list while you're traversing 
it, since the traversal is holding private state which has to remain 
consistent with the list.

If you want to release the lock on the list, you would have to detect 
when the list is changed and rescan it to find the 'new' current 
location.  Only that doesn't work either, since the list traversal allows 
you to remove the current handler from the list.

Please revert this change and fix eventhandler clients so that they don't 
sleep.


-- 
... every activity meets with opposition, everyone who acts has his
rivals and unfortunately opponents also.  But not because people want
to be opponents, rather because the tasks and relationships force
people to take different points of view.  [Dr. Fritz Todt]
           V I C T O R Y   N O T   V E N G E A N C E




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200011150325.eAF3PRF01212>