PERFORCE change 82914 for review
John Baldwin
jhb at FreeBSD.org
Wed Aug 31 18:03:50 GMT 2005
http://perforce.freebsd.org/chv.cgi?CH=82914
Change 82914 by jhb at jhb_slimer on 2005/08/31 18:03:41
Another todo.
Affected files ...
.. //depot/projects/smpng/sys/notes#52 edit
Differences ...
==== //depot/projects/smpng/sys/notes#52 (text+ko) ====
@@ -92,6 +92,49 @@
locks. Requested by Jeff.
+ Implemented
- Untested
+- Fix free race in eventhandlers:
+> In the macro "_EVENTHANDLER_INVOKE" in the file
+> "/sys/sys/eventhandler.h", you unlock the list lock
+> before calling the callback. That make sense. But what
+> happens if one process is in the callback, and another
+> process is deregistering this tag.
+>
+> The solution is that the last thread
+> that has anything to do with a entry
+> frees it:
+>
+> TAILQ_FOREACH()
+> {
+> refcount++;
+>
+> EHL_UNLOCK();
+>
+> callback();
+>
+> EHL_LOCK();
+>
+> refcount--;
+>
+> if(refcount == 0)
+> free(entry);
+> }
+>
+> At init:
+> refcount = 1;
+>
+>
+> At deregister:
+>
+> EHL_LOCK();
+>
+> refcount--;
+> if(refcount == 0)
+> free();
+>
+> EHL_UNLOCK();
+>
+> --HPS
+>
Active child branches:
- jhb_intr - intr_event stuff
More information about the p4-projects
mailing list