On 04.10.2013, at 19:16, Jens Alfke j...@mooseyard.com wrote:
On Oct 4, 2013, at 4:08 AM, Andreas Grosam agro...@onlinehome.de wrote:
Scheduling or dispatching a callback or block onto a known thread/queue
will increase the risk for a dead lock. Thus, the execution context of the
On 03.10.2013, at 22:00, Jens Alfke j...@mooseyard.com wrote:
On Oct 3, 2013, at 12:17 PM, Kyle Sluder k...@ksluder.com wrote:
What is adopting GCD going to get you if you aren't going to use GCD the
way it was intended?
…
Also, my project is a library, and I don’t want to put too many
On Oct 4, 2013, at 4:08 AM, Andreas Grosam agro...@onlinehome.de wrote:
Scheduling or dispatching a callback or block onto a known thread/queue
will increase the risk for a dead lock. Thus, the execution context of the
callback shall be created/selected by the asynchronous result provider
On Fri, Oct 4, 2013, at 10:16 AM, Jens Alfke wrote:
Basically, by calling a client-supplied block on its private internal
queue, the implementation is exposing sensitive internal state to its
callers. That seems like a really bad idea.
This jibes with my memory of Andy's argument, which I'm
The main thread of a Cocoa app has a runloop (of course) and also the main GCD
dispatch queue. This is very handy because it means tasks on that thread can be
scheduled either using the runloop (NSTimer or delayed-perform) or using GCD
(dispatch_async, dispatch_sync).
But background threads
You did not miss anything. Since a queue can run on any or multiple threads
(except the main queue), creating a runloop on it - and runloops are
thread-specific - means that one dispatched block may run on a thread that
doesn’t have the runloop created in another by a previously dispatched
On Thu, Oct 3, 2013, at 10:55 AM, Jens Alfke wrote:
The main thread of a Cocoa app has a runloop (of course) and also the
main GCD dispatch queue. This is very handy because it means tasks on
that thread can be scheduled either using the runloop (NSTimer or
delayed-perform) or using GCD
On Oct 3, 2013, at 11:09 AM, Daniel DeCovnick danhd...@mac.com wrote:
You did not miss anything. Since a queue can run on any or multiple threads
(except the main queue), creating a runloop on it - and runloops are
thread-specific - means that one dispatched block may run on a thread that
On Oct 3, 2013, at 1:46 PM, Kyle Sluder wrote:
On Thu, Oct 3, 2013, at 10:55 AM, Jens Alfke wrote:
The main thread of a Cocoa app has a runloop (of course) and also the
main GCD dispatch queue. This is very handy because it means tasks on
that thread can be scheduled either using the runloop
On Oct 3, 2013, at 11:46 AM, Kyle Sluder k...@ksluder.com wrote:
There is magic sauce in CFRunLoop that runs the main queue as part of
processing the runloop. All other queues are managed by code running on
a thread managed by libdispatch. The main queue is a special case; it
doesn't make
On Oct 3, 2013, at 11:58 AM, Ken Thomases k...@codeweavers.com 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:…]
On Thu, Oct 3, 2013, at 12:05 PM, Jens Alfke wrote:
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
On Oct 3, 2013, at 12:07 PM, Kyle Sluder k...@ksluder.com wrote:
They're fundamentally different ways of doing multiprocessing.
So to use GCD I have to rip apart all of my code that uses threads/runloops at
once and rewrite it? (As I’ve said, I don’t mind upgrading it bit by bit as I
go;
On Thu, Oct 3, 2013, at 12:14 PM, Jens Alfke wrote:
On Oct 3, 2013, at 12:07 PM, Kyle Sluder k...@ksluder.com wrote:
They're fundamentally different ways of doing multiprocessing.
So to use GCD I have to rip apart all of my code that uses
threads/runloops at once and rewrite it? (As
On Oct 3, 2013, at 12:17 PM, Kyle Sluder k...@ksluder.com wrote:
What is adopting GCD going to get you if you aren't going to use GCD the
way it was intended?
Could you be a bit friendlier here and cut me some slack? Of course I want to
use GCD in the way it’s intended. I’m an experienced
On Oct 3, 2013, at 3:00 PM, Jens Alfke wrote:
Also, my project is a library, and I don’t want to put too many restrictions
on how it’s used by the caller. For example, here’s one method that runs an
async query:
- (void) runAsync: (void (^)(CBLQueryEnumerator*))onComplete;
When the
On Oct 3, 2013, at 1:23 PM, Ken Thomases k...@codeweavers.com wrote:
I've seen APIs, including some from Apple, that take a queue as an argument
for where a completion block should be invoked. I've always thought they
were a bit silly. If the caller's onComplete block needs to be run in a
On Oct 3, 2013, at 3:55 PM, Jens Alfke wrote:
On Oct 3, 2013, at 1:23 PM, Ken Thomases k...@codeweavers.com wrote:
I'm not seeing how the above API would be easier/cleaner to implement if run
loops had queues.
Because the implementation could initially capture the current dispatch queue
On 3 Oct 2013, at 20:00, Jens Alfke j...@mooseyard.com wrote:
On Oct 3, 2013, at 11:46 AM, Kyle Sluder k...@ksluder.com wrote:
There is magic sauce in CFRunLoop that runs the main queue as part of
processing the runloop. All other queues are managed by code running on
a thread managed by
On Oct 3, 2013, at 4:04 PM, Ken Thomases wrote:
On Oct 3, 2013, at 3:55 PM, Jens Alfke wrote:
On Oct 3, 2013, at 1:23 PM, Ken Thomases k...@codeweavers.com wrote:
I'm not seeing how the above API would be easier/cleaner to implement if
run loops had queues.
Because the implementation
On 3 Oct 2013, at 20:14, Jens Alfke j...@mooseyard.com wrote:
On Oct 3, 2013, at 12:07 PM, Kyle Sluder k...@ksluder.com wrote:
They're fundamentally different ways of doing multiprocessing.
So to use GCD I have to rip apart all of my code that uses threads/runloops
at once and rewrite
On Oct 3, 2013, at 2:04 PM, Ken Thomases k...@codeweavers.com wrote:
Well, you've gone from requesting the ability to assign a queue to a run loop
to assuming that all run loops would have queues.
You’re right. I think I was implicitly imagining it would be like [NSRunLoop
currentRunLoop]
On Oct 3, 2013, at 2:09 PM, Mike Abdullah mabdul...@karelia.com wrote:
You can actually target a custom queue at any other queue you like, to create
a whole chain of them. Work submitted to such queues ends up executing within
the context of multiple queues at once.
OK, this I did not
On 3 Oct 2013, at 22:37, Jens Alfke j...@mooseyard.com wrote:
On Oct 3, 2013, at 2:09 PM, Mike Abdullah mabdul...@karelia.com wrote:
You can actually target a custom queue at any other queue you like, to
create a whole chain of them. Work submitted to such queues ends up
executing
On Thu, Oct 3, 2013, at 01:00 PM, Jens Alfke wrote:
On Oct 3, 2013, at 12:17 PM, Kyle Sluder k...@ksluder.com wrote:
What is adopting GCD going to get you if you aren't going to use GCD the
way it was intended?
Could you be a bit friendlier here and cut me some slack? Of course I
want
My point is that using GCD is not a win if you aren't actually going to
use it in a way that is compatible with its design
Er, I obviously meant incompatible here.
--Kyle Sluder
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not
On Oct 3, 2013, at 6:06 PM, Kyle Sluder k...@ksluder.com wrote:
Other people have addressed the dispatch_get_current_queue() problem.
Andy Matuschak has opined that the correct way to design an API that
accepts a block argument is to also accept a dispatch queue on which to
run that block.
On Oct 3, 2013, at 6:22 PM, Charles Srstka cocoa...@charlessoft.com wrote:
The problem I see with queue arguments is that there are two types of queues
that people might be using — dispatch_queue_t and NSOperationQueue — and
there doesn't seem to be a way to convert one into the other. So
There are books.
Pro Multithreading and Memory Management for iOS and OSX
(Apress)
By Kazuki Sakamoto and Tomohiko Furumoto
Actually not bad.
Concurrent Programming in Mac OSX and ios
(Oreilly)
Vandad Nahavandipoor
Not as thorough.
Sent from my iPhone
On 2013/10/04, at 8:01, Mike
Also
Advanced Mac OSX Programming
(Big Nerd Ranch)
By Mark Dalrymple
Covers CFRunLoop NSThread and GCD but not as deeply.
Sent from my iPhone
On 2013/10/04, at 13:03, dangerwillrobinsondan...@gmail.com wrote:
There are books.
Pro Multithreading and Memory Management for iOS and OSX
30 matches
Mail list logo