~thopiekar/gnustep/dep-libdispatch

« back to all changes in this revision

Viewing changes to src/source.c

  • Committer: dsteffen@apple.com
  • Date: 2010-01-27 17:32:37 UTC
  • Revision ID: git-v1:4069951af0db90fc9d9dfc56083f04e890d6b1b3
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>

git-svn-id: http://svn.macosforge.org/repository/libdispatch/trunk@183 5710d607-3af0-45f8-8f96-4508d4f60227

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
        _dispatch_release(ds);
61
61
}
62
62
 
63
 
#ifndef DISPATCH_NO_LEGACY
 
63
DISPATCH_NOINLINE
64
64
void
65
 
_dispatch_source_legacy_xref_release(dispatch_source_t ds)
 
65
_dispatch_source_xref_release(dispatch_source_t ds)
66
66
{
 
67
#ifndef DISPATCH_NO_LEGACY
67
68
        if (ds->ds_is_legacy) {
68
69
                if (!(ds->ds_timer.flags & DISPATCH_TIMER_ONESHOT)) {
69
70
                        dispatch_source_cancel(ds);
70
71
                }
71
 
 
72
72
                // Clients often leave sources suspended at the last release
73
73
                dispatch_atomic_and(&ds->do_suspend_cnt, DISPATCH_OBJECT_SUSPEND_LOCK);
74
 
        } else if (slowpath(DISPATCH_OBJECT_SUSPENDED(ds))) {
 
74
        } else
 
75
#endif
 
76
        if (slowpath(DISPATCH_OBJECT_SUSPENDED(ds))) {
75
77
                // Arguments for and against this assert are within 6705399
76
78
                DISPATCH_CLIENT_CRASH("Release of a suspended object");
77
79
        }
78
80
        _dispatch_wakeup(ds);
79
81
        _dispatch_release(ds);
80
82
}
81
 
#endif /* DISPATCH_NO_LEGACY */
82
83
 
83
84
long
84
85
dispatch_source_testcancel(dispatch_source_t ds)