Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSOperationMBS class.

NSOperationMBS.addDependency(op as NSOperationMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Makes the receiver dependent on the completion of the specified operation.

op: The operation on which the operation is dependent. The same dependency should not be added more than once to the operation, and the results of doing so are undefined.

The dependent is not considered ready to execute until all of its dependent operations finish executing. If the receiver is already executing its task, adding dependencies is unlikely to have any practical effect. This method may change the isReady and dependencies properties of the dependent.

It is a programmer error to create any circular dependencies among a set of operations. Doing so can cause a deadlock among the operations and may freeze your program.

Please setup dependencies before you add the operation to a queue. Once the operation is in the queue it may be executed directly.

NSOperationMBS.cancel

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Advises the operation object that it should stop executing its task.

This method does not force your operation code to stop. The code for your operation must invoke the isCancelled method periodically to determine whether the operation should be stopped. Once cancelled, an operation cannot be restarted.

If the operation is already finished executing, this method has no effect. Canceling an operation that is currently in an operation queue, but not yet executing, causes it to be removed from the queue (although not necessarily right away).

NSOperationMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 17.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The constructor.

See also:

NSOperationMBS.Constructor(Handle as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 17.2 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The constructor.

You can pass in handle to NSOperation object.

See also:

NSOperationMBS.dependencies as NSOperationMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
the operations on which the operation is dependent.

The receiver is not considered ready to execute until all of its dependent operations finish executing.

NSOperationMBS.dependenciesCount as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The number of the dependencies.

NSOperationMBS.dependency(index as Integer) as NSOperationMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns the dependency at the given index.

The receiver is not considered ready to execute until all of its dependent operations finish executing.

Operations are not removed from this dependency list as they finish executing. You can therefore use this list to track all dependent operations, including those that have already finished executing. The only way to remove an operation from this list is to use the removeDependency method.

Available in Mac OS X v10.5 and later.

NSOperationMBS.isCancelled as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns a Boolean value indicating whether the operation has been cancelled.

True if the operation was explicitly cancelled by an invocation of the operation's cancel method; otherwise, false. This method may return true even if the operation is currently executing.

Discussion
Canceling an operation does not actively stop the operation's code from executing. An operation object is responsible for calling this method periodically and stopping itself if the method returns true.

NSOperationMBS.isConcurrent as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns a Boolean value indicating whether the operation runs asynchronously.

True if the operation is asynchronous; otherwise, false if the operation runs synchronously on whatever thread started it. This method returns false by default.

NSOperationMBS.isExecuting as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns a Boolean value indicating whether the operation is currently executing.

True if the operation is executing; otherwise, false if the operation has not been started or is already finished.

NSOperationMBS.isFinished as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
A Boolean value indicating whether the operation is done executing.

True if the operation is no longer executing; otherwise, false.

NSOperationMBS.isReady as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Returns a Boolean value indicating whether the operation can be performed now.

True if the operation can be performed now; otherwise, false.

Operations may not be ready due to dependencies on other operations or because of external conditions that might prevent needed data from being ready. The NSOperation class manages dependencies on other operations and reports the readiness of the receiver based on those dependencies.

Note: If the operation is cancelled before it starts, operations that are dependent on the completion of the receiver will never become ready.

NSOperationMBS.Lock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Locks the semaphore.
Example
dim o as NSOperationMBS // your operation
dim myarray(-1) as window

o.lock
myarray.append window1
o.unlock

You need to pair all calls to Xojo runtime into lock and unlock to make sure you don't crash. Xojo is not reentrant safe, so you need to lock.

Be aware that locking costs performance. You should do locks often, so in the time between two locks another thread can get a lock. Also you should group locks nearby so you don't waste too much time waiting for the lock. Finally you need your main application thread to run nice so it doesn't lock too much, too.

NSOperationMBS.main

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Performs the operation's non-concurrent task.

This will just call to the work event.

NSOperationMBS.queuePriority as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The priority of the operation in an operation queue.

The relative priority of the operation. The returned value always corresponds to one of the predefined constants. If no priority is explicitly set, this method returns NSOperationQueuePriorityNormal.

You should use priority values only as needed to classify the relative priority of non-dependent operations. Priority values should not be used to implement dependency management among different operation objects. If you need to establish dependencies between operations, use the addDependency method instead.

If you attempt to specify a priority value that does not match one of the defined constants, this method automatically adjusts the value you specify towards the NSOperationQueuePriorityNormal priority, stopping at the first valid constant value. For example, if you specified the value -10, this method would adjust that value to match the NSOperationQueuePriorityVeryLow constant. Similarly, if you specified +10, this method would adjust the value to match the NSOperationQueuePriorityVeryHigh constant.
(Read and Write computed property)

NSOperationMBS.removeDependency(op as NSOperationMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Removes the operation's dependence on the specified operation.

This method may change the isReady and dependencies properties of the operation.

NSOperationMBS.start

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Begins the execution of the operation.

The default implementation of this method configures the execution environment for a non-concurrent operation and invokes the operation's main method. As part of the default configuration, this method performs several checks to ensure that the non-concurrent operation can actually run and generates appropriate KVO notifications for each change in the operation's state. If the operation's operation has already been performed, was cancelled, or is not yet ready to run, this method throws an NSInvalidArgumentException exception. If the operation is to be performed on a separate thread, this method may return before the operation itself completes on the other thread.

NSOperationMBS.threadPriority as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Threading MBS MacFrameworks Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
The thread priority to use when executing the operation.

A floating-point number in the range 0.0 to 1.0, where 1.0 is the highest priority. The default thread priority is 0.5.

Available in Mac OS X v10.6 and later.
(Read and Write computed property)

NSOperationMBS.Unlock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 8.0 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Unlocks the semaphore.
Example
dim o as NSOperationMBS // your operation
dim myarray(-1) as window

o.lock
myarray.append window1
o.unlock

You need to pair all calls to Xojo runtime into lock and unlock to make sure you don't crash. Xojo is not reentrant safe, so you need to lock.

Be aware that locking costs performance. You should do locks often, so in the time between two locks another thread can get a lock. Also you should group locks nearby so you don't waste too much time waiting for the lock. Finally you need your main application thread to run nice so it doesn't lock too much, too.

NSOperationMBS.waitUntilFinished

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Threading MBS MacFrameworks Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Spend time waiting for the operation to finish.

The items on this page are in the following plugins: MBS MacFrameworks Plugin.


The biggest plugin in space...