• 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
How to get the dispatch queue for the current thread's runloop?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How to get the dispatch queue for the current thread's runloop?


  • Subject: How to get the dispatch queue for the current thread's runloop?
  • From: Jens Alfke <email@hidden>
  • Date: Fri, 27 Jan 2012 12:14:36 -0800

I'm really used to using -performSelector:withObject:afterDelay: to make something happen later. But I'd much rather use a block than a target/action. I can't find any API for this, however. Am I missing something? What I want is basically like
	PerformBlockAfterDelay(^{ …code here…}, 5.0);

It looks like I should just call dispatch_async, but I'm unsure which dispatch queue to use. dispatch_get_main_queue only works for the main thread. Can I use dispatch_get_current_queue? I'm unsure of what this does when called on a background thread. The API docs say "If the call is made from any other thread, this function returns the default concurrent queue" … is that a queue associated with the thread's runloop, that's guaranteed to execute tasks on that thread?

—Jens


_______________________________________________

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 to get the dispatch queue for the current thread's runloop?
      • From: Steve Sisak <email@hidden>
    • Re: How to get the dispatch queue for the current thread's runloop?
      • From: Ken Thomases <email@hidden>
    • Re: How to get the dispatch queue for the current thread's runloop?
      • From: Dave Keck <email@hidden>
    • Re: How to get the dispatch queue for the current thread's runloop?
      • From: Kyle Sluder <email@hidden>
    • Re: How to get the dispatch queue for the current thread's runloop?
      • From: Wade Tregaskis <email@hidden>
    • Re: How to get the dispatch queue for the current thread's runloop?
      • From: Conrad Shultz <email@hidden>
    • Re: How to get the dispatch queue for the current thread's runloop?
      • From: Dave Fernandes <email@hidden>
    • Re: How to get the dispatch queue for the current thread's runloop?
      • From: Marco Tabini <email@hidden>
  • Prev by Date: Re: Full-Height Toolbar Item
  • Next by Date: Re: How to get the dispatch queue for the current thread's runloop?
  • Previous by thread: Re: Recently Opened in Doc
  • Next by thread: Re: How to get the dispatch queue for the current thread's runloop?
  • Index(es):
    • Date
    • Thread