• 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: Can I create a thread with a runloop and a dispatch queue?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can I create a thread with a runloop and a dispatch queue?


  • Subject: Re: Can I create a thread with a runloop and a dispatch queue?
  • From: Jens Alfke <email@hidden>
  • Date: Thu, 03 Oct 2013 12:05:11 -0700

On Oct 3, 2013, at 11:58 AM, Ken Thomases <email@hidden> wrote:

> That said, it's simple enough to write a category on NSThread such that you can ask a thread to run a block and it will do so when its run loop is run.  Basically, it would leverage -[NSObject performSelector:onThread:…] and the block would run in the same circumstances as a selector would.

I’ve already got that and use it a lot in my code (see MYBlockUtils.m in MYUtilities.)

> There is the question of why you want to dedicate a thread to running such requests (and other run loop sources) rather than using the GCD worker threads.

Because I’ve got tens of thousands of lines of code*, a lot of which does some tricky asynchronous work using the runloop/thread paradigm, and I don’t want to break it by rewriting all of it en masse to use GCD. If I could start using GCD in new parts of the code that would be great, but when I tried to do so I ran into these impedance mismatches and had to tear it out.

—Jens

* https://github.com/couchbase/couchbase-lite-ios
_______________________________________________

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: Can I create a thread with a runloop and a dispatch queue?
      • From: Kyle Sluder <email@hidden>
References: 
 >Re: Can I create a thread with a runloop and a dispatch queue? (From: Kyle Sluder <email@hidden>)
 >Re: Can I create a thread with a runloop and a dispatch queue? (From: Ken Thomases <email@hidden>)

  • Prev by Date: Re: Can I create a thread with a runloop and a dispatch queue?
  • Next by Date: Re: How to get a "Normal" button in iOS 7/IB
  • Previous by thread: Re: Can I create a thread with a runloop and a dispatch queue?
  • Next by thread: Re: Can I create a thread with a runloop and a dispatch queue?
  • Index(es):
    • Date
    • Thread