Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

NSOperationMBS.addDependency(op as NSOperationMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Makes the receiver dependent on the completion of the specified operation.
Notes:
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.

Feedback, Comments & Corrections

NSOperationMBS.cancel
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Advises the operation object that it should stop executing its task.
Notes:
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).

Feedback, Comments & Corrections

NSOperationMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 17.2 Yes No No Yes, macOS only No
Function: The constructor.

See also:

Feedback, Comments & Corrections

NSOperationMBS.Constructor(Handle as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 17.2 Yes No No Yes, macOS only No
Function: The constructor.
Notes: You can pass in handle to NSOperation object.

See also:

Feedback, Comments & Corrections

NSOperationMBS.dependencies as NSOperationMBS()
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: the operations on which the operation is dependent.
Notes: The receiver is not considered ready to execute until all of its dependent operations finish executing.

Feedback, Comments & Corrections

NSOperationMBS.dependenciesCount as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: The number of the dependencies.

Feedback, Comments & Corrections

NSOperationMBS.dependency(index as Integer) as NSOperationMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 9.6 Yes No No Yes, macOS only No
Function: Returns the dependency at the given index.
Notes:
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.

Feedback, Comments & Corrections

NSOperationMBS.isCancelled as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Returns a Boolean value indicating whether the operation has been cancelled.
Notes:
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.

Feedback, Comments & Corrections

NSOperationMBS.isConcurrent as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Returns a Boolean value indicating whether the operation runs asynchronously.
Notes: True if the operation is asynchronous; otherwise, false if the operation runs synchronously on whatever thread started it. This method returns false by default.

Feedback, Comments & Corrections

NSOperationMBS.isExecuting as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Returns a Boolean value indicating whether the operation is currently executing.
Notes: True if the operation is executing; otherwise, false if the operation has not been started or is already finished.

Feedback, Comments & Corrections

NSOperationMBS.isFinished as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: A Boolean value indicating whether the operation is done executing.
Notes: True if the operation is no longer executing; otherwise, false.

Feedback, Comments & Corrections

NSOperationMBS.isReady as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Returns a Boolean value indicating whether the operation can be performed now.
Notes:
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.

Feedback, Comments & Corrections

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

o.lock
myarray.append window1
o.unlock
Notes:
You need to pair all calls to REALbasic runtime into lock and unlock to make sure you don't crash. REALbasic 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.

Feedback, Comments & Corrections

NSOperationMBS.main
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Performs the operation's non-concurrent task.
Notes: This will just call to the work event.

Feedback, Comments & Corrections

NSOperationMBS.queuePriority as Integer
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: The priority of the operation in an operation queue.
Notes:
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)

Feedback, Comments & Corrections

NSOperationMBS.removeDependency(op as NSOperationMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Removes the operation's dependence on the specified operation.
Notes: This method may change the isReady and dependencies properties of the operation.

Feedback, Comments & Corrections

NSOperationMBS.start
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 8.0 Yes No No Yes, macOS only No
Function: Begins the execution of the operation.
Notes: 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.

Feedback, Comments & Corrections

NSOperationMBS.threadPriority as Double
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
property Cocoa Threading MBS MacFrameworks Plugin 9.6 Yes No No Yes, macOS only No
Function: The thread priority to use when executing the operation.
Notes:
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)

Feedback, Comments & Corrections

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

o.lock
myarray.append window1
o.unlock
Notes:
You need to pair all calls to REALbasic runtime into lock and unlock to make sure you don't crash. REALbasic 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.

Feedback, Comments & Corrections

NSOperationMBS.waitUntilFinished
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa Threading MBS MacFrameworks Plugin 9.6 Yes No No Yes, macOS only No
Function: Spend time waiting for the operation to finish.

Feedback, Comments & Corrections

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




Links
MBS Xojo Plugins