Re: Background Process?
Re: Background Process?
- Subject: Re: Background Process?
- From: "A.M." <email@hidden>
- Date: Wed, 11 Mar 2009 10:35:15 -0400
On Mar 11, 2009, at 2:42 AM, Ken Thomases wrote:
All irrelevant, as there's no need for any signaling of any run loop
input sources to allow timers to fire.
And the best source is the source:
http://www.opensource.apple.com/darwinsource/10.5.6/CF-476.17/CFRunLoop.c
static void __CFRunLoopTimerSchedule(CFRunLoopTimerRef rlt,
CFRunLoopRef rl, CFRunLoopModeRef rlm) {
#if DEPLOYMENT_TARGET_MACOSX
__CFRunLoopTimerLock(rlt);
if (0 == rlt->_rlCount) {
rlt->_runLoop = rl;
if (MACH_PORT_NULL == rlt->_port) {
rlt->_port = mk_timer_create();
}
__CFRunLoopTimerPortMapLock();
if (NULL == __CFRLTPortMap) {
__CFRLTPortMap =
CFDictionaryCreateMutable(kCFAllocatorSystemDefault, 0, NULL, NULL);
}
CFDictionarySetValue(__CFRLTPortMap, (void *)(uintptr_t)rlt->_port,
rlt);
__CFRunLoopTimerPortMapUnlock();
}
rlt->_rlCount++;
mach_port_insert_member(mach_task_self(), rlt->_port, rlm-
>_portSet);
mk_timer_arm(rlt->_port, __CFUInt64ToAbsoluteTime(rlt->_fireTSR));
__CFRunLoopTimerUnlock(rlt);
#endif
}
mach timers are blocked for in the subsequent CFRunLoopRun:
/* In that sleep of death what nightmares may come ... */
try_receive:
msg->msgh_bits = 0;
msg->msgh_local_port = waitSet;
msg->msgh_remote_port = MACH_PORT_NULL;
msg->msgh_id = 0;
ret = mach_msg(msg, MACH_RCV_MSG|MACH_RCV_LARGE|(poll ?
MACH_RCV_TIMEOUT : 0)|MACH_RCV_TRAILER_TYPE(MACH_MSG_TRAILER_FORMAT_0)|
MACH_RCV_TRAILER_ELEMENTS(MACH_RCV_TRAILER_AUDIT), 0, msg->msgh_size,
waitSet, 0, MACH_PORT_NULL);
Cheers,
M
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden