[libdispatch-changes] [183] trunk/src

source_changes at macosforge.org source_changes at macosforge.org
Wed Jan 27 09:32:38 PST 2010


Revision: 183
          http://trac.macosforge.org/projects/libdispatch/changeset/183
Author:   dsteffen at apple.com
Date:     2010-01-27 09:32:37 -0800 (Wed, 27 Jan 2010)
Log Message:
-----------
Final dispatch_release() needs to call _dispatch_wakeup() for sources even
when libdispatch is built with DISPATCH_NO_LEGACY, to ensure sources that
have not been cancelled get uninstalled on final release.
<rdar://problem/7581831>

Modified Paths:
--------------
    trunk/src/object.c
    trunk/src/source.c
    trunk/src/source_internal.h

Modified: trunk/src/object.c
===================================================================
--- trunk/src/object.c	2010-01-27 17:32:30 UTC (rev 182)
+++ trunk/src/object.c	2010-01-27 17:32:37 UTC (rev 183)
@@ -87,11 +87,9 @@
 		return;
 	}
 	if (oldval == 1) {
-#ifndef DISPATCH_NO_LEGACY
 		if (dou._do->do_vtable == (void*)&_dispatch_source_kevent_vtable) {
-			return _dispatch_source_legacy_xref_release(dou._ds);
+			return _dispatch_source_xref_release(dou._ds);
 		}
-#endif
 		if (slowpath(DISPATCH_OBJECT_SUSPENDED(dou._do))) {
 			// Arguments for and against this assert are within 6705399
 			DISPATCH_CLIENT_CRASH("Release of a suspended object");

Modified: trunk/src/source.c
===================================================================
--- trunk/src/source.c	2010-01-27 17:32:30 UTC (rev 182)
+++ trunk/src/source.c	2010-01-27 17:32:37 UTC (rev 183)
@@ -60,25 +60,26 @@
 	_dispatch_release(ds);
 }
 
-#ifndef DISPATCH_NO_LEGACY
+DISPATCH_NOINLINE
 void
-_dispatch_source_legacy_xref_release(dispatch_source_t ds)
+_dispatch_source_xref_release(dispatch_source_t ds)
 {
+#ifndef DISPATCH_NO_LEGACY
 	if (ds->ds_is_legacy) {
 		if (!(ds->ds_timer.flags & DISPATCH_TIMER_ONESHOT)) {
 			dispatch_source_cancel(ds);
 		}
-
 		// Clients often leave sources suspended at the last release
 		dispatch_atomic_and(&ds->do_suspend_cnt, DISPATCH_OBJECT_SUSPEND_LOCK);
-	} else if (slowpath(DISPATCH_OBJECT_SUSPENDED(ds))) {
+	} else
+#endif
+	if (slowpath(DISPATCH_OBJECT_SUSPENDED(ds))) {
 		// Arguments for and against this assert are within 6705399
 		DISPATCH_CLIENT_CRASH("Release of a suspended object");
 	}
 	_dispatch_wakeup(ds);
 	_dispatch_release(ds);
 }
-#endif /* DISPATCH_NO_LEGACY */
 
 long
 dispatch_source_testcancel(dispatch_source_t ds)

Modified: trunk/src/source_internal.h
===================================================================
--- trunk/src/source_internal.h	2010-01-27 17:32:30 UTC (rev 182)
+++ trunk/src/source_internal.h	2010-01-27 17:32:37 UTC (rev 183)
@@ -98,7 +98,7 @@
 };
 
 
-void _dispatch_source_legacy_xref_release(dispatch_source_t ds);
+void _dispatch_source_xref_release(dispatch_source_t ds);
 dispatch_queue_t _dispatch_source_invoke(dispatch_source_t ds);
 bool _dispatch_source_probe(dispatch_source_t ds);
 void _dispatch_source_dispose(dispatch_source_t ds);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/libdispatch-changes/attachments/20100127/c5fa16b2/attachment.html>


More information about the libdispatch-changes mailing list