Questions tagged [nsoperationqueue]

On Mac OS X, the NSOperationQueue class regulates the execution of a set of NSOperation objects.

The NSOperationQueue class regulates the execution of a set of NSOperation () objects. After being added to a queue, an operation remains in that queue until it is explicitly canceled or finishes executing its task. Operations within the queue (but not yet executing) are themselves organized according to priority levels and inter-operation object dependencies and are executed accordingly. An application may create multiple operation queues and submit operations to any of them.

References:

1047 questions
2
votes
0 answers

What could cause a deadlock in ImageProviderReleaseInfoCallback / __spin_lock

I have a Cocoa application that uses a number of NSOperationQueue instances to process images in the background. Each queue processes invocation operations that essentially turn NSImage objects into CGImageRef instances using: CGImageRef ref =…
Mark
  • 6,647
  • 1
  • 45
  • 88
2
votes
1 answer

NSOperationQueue vs NSThread Priority -- controlling how much cpu is consumed in NSOperationQueue

I have some textures and sound effects preloading I need to do asynchronously to create a smooth user experience in an iOS game I am developing. I am trying to decide between NSOperationQueue and NSThread to load these game resources during…
mattorb
  • 3,075
  • 3
  • 22
  • 16
2
votes
2 answers

performSelectorOnMainThread results in "unrecognized selector sent to instance"

Firstly thanks in advance for your time looking at this question. I'm trying to create a very simple UIViewController example, where I load the data in a thread. The thread is getting called but from that thread, I can't get back to the main…
user930731
  • 145
  • 1
  • 3
  • 5
2
votes
2 answers

performSelector in NSOperation subclass

I couldn't find an answer anywhere else on the net so any help would be appreciated. I am tying to create a system whereby I can retrieve the results of an NSOperation task, which I understand cannot be done by concrete subclasses such as…
2
votes
1 answer

ASINetworkQueue setQueueDidFinishSelector selector ending prematurely ?

I've just started testing some upload utility i've built and put 47 items for upload, but the queue stops randomly at the 15th or 18th or 21st item, not sure exactly why, but the selector is being called too early while not all the requests are…
Shai Mishali
  • 9,224
  • 4
  • 56
  • 83
2
votes
2 answers

Handling data returned from multiple NSOperation objects in an NSOperation object that depends on them

I am writing a web-connected application that needs to execute several asynchronous requests to load data needed lower down in the dependency tree. Fig 1. For visualization purposes, consider an example with ASIHTTPRequests A,B,C,D,E, and F: A's…
2
votes
1 answer

Is DispatchQueue using RunLoop?

Every Thread has its own RunLoop, how DispatchQueue interact with them? Is DispatchQueue using RunLoop to dispatch task to Thread or do it by another way?
2
votes
2 answers

Running a Combine chain in a thread-safe way

I have an existing flow implemented using Operation subclasses and an OperationQueue. I'm trying reimplement in Combine as a learning exercise. The current version, simplified, looks like this: func testFunction(completionHandler: (Result) -> Void)…
Mattie
  • 2,868
  • 2
  • 25
  • 40
2
votes
1 answer

SwiftySandboxFileAccess UserDefaults value

SwiftySandboxFileAccess works the first time the user approves the NSOpenPanel selection, but the next time the app opens, the security bookmark doesn't have access even though SwiftySandboxFileAccess thinks it has access just because a value is…
2
votes
3 answers

How do I repeat an ASIHTTPRequest?

Given the example code below: // ExampleModel.h @interface ExampleModel : NSObject { } @property (nonatomic, retain) ASIFormDataRequest *request; @property (nonatomic, copy) NSString *iVar; - (void)sendRequest; //…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
2
votes
2 answers

Does @synchronize protect against race conditions in this case?

I want to use Core Data in background threads and NSOperationQueue. Now I thought why shouldn't I just create a class holding all the Core Data stack things with a property of NSManagedObjectContext, and then just make this property atomic? One…
Proud Member
  • 40,078
  • 47
  • 146
  • 231
2
votes
3 answers

Are there tutorials of how to use NSOperationQueue without blocks?

My app must run on iOS 3.2 and the methods such as -addOperationWithBlock: only work in > 4.0. But NSOperationQueue was available since iOS 2.0 so I'd like to give it a try the "old way". Does anyone know of a handy tutorial that shows the basics of…
Proud Member
  • 40,078
  • 47
  • 146
  • 231
2
votes
1 answer

NSOperationQueue and NSFetchedResultsController

i use a combination of queue and resultscontroller to update and display some coredata objects. in my uitableviewcontroller i call every X second a method in my main controller object. [NSTimer scheduledTimerWithTimeInterval:2 target:self…
user547064
  • 217
  • 1
  • 4
  • 14
2
votes
1 answer

Canceling OperationQueue Swift

I'm learning OperationQueue. What I want to do is to prevent network calls if there's an ongoing call. The problem is that when I tap on the button, a new operation is being added to the queue. class ViewController: UIViewController { private…
Glenn Posadas
  • 12,555
  • 6
  • 54
  • 95
2
votes
2 answers

main in my NSOperation subclass not being called

I subclassed NSOperation and implemented the main method. When I added it to an NSOperationQueue, it was not being called. I compared it to sample code and sample projects that do work and could not see what the problem was. Does anyone have any…
stifin
  • 1,390
  • 3
  • 18
  • 28