• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback?


  • Subject: Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback?
  • From: "Jim O'Connor" <email@hidden>
  • Date: Sun, 05 Jan 2014 16:02:45 -0900

I punctuated that poorly.
I can run the CFRunLoop myself. Or it is (nearly) the top level for the thread, typically.
It shouldn't be the case that timers fire other than with a CFRunLoop() just above them in the stack, though, right?

As I said, it was really late after a long long day, so maybe I didn't read it correctly. I should have saved off the stack crawl. At this point I want to be sure I don't have a fundamental misunderstanding of something I thought was a constant, though. If the OS is going to call the runloop on me it should change the mode.

Thanks for the reply.

Jim


On Jan 5, 2014, at 3:47 PM, Kyle Sluder <email@hidden> wrote:

> On Jan 5, 2014, at 4:37 PM, Jim O'Connor <email@hidden> wrote:
>>
>> When my read stream finishes I schedule a timer to clean up on the runloop to serialize access to shared resources.
>> However, I had a hang late last night because a mutex grabbed in the read stream callback handler was held and was also being grabbed when the timer it scheduled to clean up fired INSIDE the callback.
>> It was late and I didn't save the odd message in the Xcode stack crawl about the timer being called OUTSIDE of the runloop. And now I can't get it to repeat.
>>
>> I was under the impression that timers only fired when the RunLoop was actually the top of the execution stack, or was called explicitly by me. Is this not right?
>
> Well, barring a memory smasher, CFReadStream isn’t going to directly invoke your timer callback function.
>
> But your use of “top of the execution stack” seems a little off to me. It’s possible to manually run a runloop from a deeper stack frame; this is often done by APIs which present a callback interface but need to use asynchrony internally.
>
> The run loop doesn’t care that it’s being run from code that itself is being indirectly called as a result of a turn of the same run loop, so it will fire its timers just like normal.
>
> --Kyle Sluder


_______________________________________________

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


  • Follow-Ups:
    • Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback?
      • From: "davekeck ." <email@hidden>
References: 
 >How is my CFRunLoopTimer getting called during a CFReadStream client callback? (From: "Jim O'Connor" <email@hidden>)
 >Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback? (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback?
  • Next by Date: Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback?
  • Previous by thread: Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback?
  • Next by thread: Re: How is my CFRunLoopTimer getting called during a CFReadStream client callback?
  • Index(es):
    • Date
    • Thread