예제 #1
0
CF_EXPORT void
rwsched_tasklet_CFRunLoopTimerRelease(rwsched_tasklet_ptr_t sched_tasklet,
                                      rwsched_CFRunLoopTimerRef rwsched_timer)
{
    // Validate input paraemters
    RW_CF_TYPE_VALIDATE(sched_tasklet, rwsched_tasklet_ptr_t);
    rwsched_instance_ptr_t instance = sched_tasklet->instance;
    RW_CF_TYPE_VALIDATE(instance, rwsched_instance_ptr_t);

    rwsched_timer->release_called = 1;

    if (rwsched_timer->index)
        rwsched_tasklet_CFRunLoopTimerInvalidate(sched_tasklet, rwsched_timer);

    // Call the native CFRunLoop function
    CFRelease(rwsched_timer->cf_object);

    RW_CF_TYPE_FREE(rwsched_timer, rwsched_CFRunLoopTimerRef);

    rwsched_tasklet_unref(sched_tasklet);
    rwsched_instance_unref(instance);
}
예제 #2
0
static void
rwsched_dispatch_intercept(void *ud)
{
  rwsched_dispatch_what_ptr_t what = ud;

  // Validate input paraemters
  RW_ASSERT_TYPE(what, rwsched_dispatch_what_ptr_t);
  RW_ASSERT(what->closure.handler);
  rwsched_tasklet_ptr_t sched_tasklet = what->tasklet_info;
  RW_CF_TYPE_VALIDATE(sched_tasklet, rwsched_tasklet_ptr_t);

  g_rwresource_track_handle = sched_tasklet->rwresource_track_handle;
  g_tasklet_info = sched_tasklet;

  (what->closure.handler)(what->closure.context);

  RW_FREE_TYPE(what, rwsched_dispatch_what_ptr_t);
  rwsched_tasklet_unref(sched_tasklet);

  g_tasklet_info = 0;
  g_rwresource_track_handle = 0;
}