Lynkeos
|
This class implements a connection between threads in the same adress space. More...
#import <LynkeosThreadConnection.h>
Instance Methods | |
(NSPort *) | - mainPort |
Accessor to the port of the "main" end of the connection. More... | |
(NSPort *) | - threadPort |
Accessor to the port of the "thread" end of the connection. More... | |
(BOOL) | - connectionIdle |
Check wether some message remains to be processed. More... | |
(NSProxy *) | - proxyForObject:inThread: |
Creation of a proxy for the object controlling one thread. More... | |
(void) | - setRootObject: |
Set the object controlling the creating thread. More... | |
(NSProxy *) | - rootProxy |
Access to the proxy for the object controlling the creating thread. More... | |
(id) | - initWithMainPort:threadPort: |
Connection initialization. More... | |
(id) | - initWithMainPort:threadPort:queueSize: |
Connection initialization. More... | |
Class Methods | |
(void) | + performSelectorOnMainThread:forObject:withArg: |
Call a selector on an object on the main thread. More... | |
This class implements a connection between threads in the same adress space.
Contrary to the standard NSConnection, the arguments to inter-thread calls are passed by address. This saves time but forbid use in inter-process or network messaging.
The thread which creates the connection is called "main" hereunder, even though it can be any thread.
- (BOOL) connectionIdle |
Check wether some message remains to be processed.
You do not need to call this before releasing the connection as it itself waits for idle state before deallocating.
Connection initialization.
mainPort | The port of the creating thread |
threadPort | The port for the created thread |
- (id) initWithMainPort: | (NSPort*) | mainPort | |
threadPort: | (NSPort*) | threadPort | |
queueSize: | (int) | queueSize | |
Connection initialization.
mainPort | The port of the creating thread |
threadPort | The port for the created thread |
queueSize | Number of elements to queue when Mach port is full |
- (NSPort *) mainPort |
Accessor to the port of the "main" end of the connection.
+ (void) performSelectorOnMainThread: | (SEL) | sel | |
forObject: | (NSObject*) | target | |
withArg: | (id) | arg | |
Call a selector on an object on the main thread.
The selector shall take only one argument of type id, or no argument at all.
The LynkeosThreadConnection registered for the current thread will be used for sending the request.
sel | The selector to perform |
target | The target object |
arg | The only argument of the method being called |
Referenced by LynkeosProcessingParameterMgr::notifyItemModification:.
- (NSProxy *) proxyForObject: | (id) | object | |
inThread: | (BOOL) | inThread | |
Creation of a proxy for the object controlling one thread.
The proxy shall be released (in either thread) before its connection is deallocated.
object | The controlling object |
inThread | Selects the created thread if YES |
Referenced by rootProxy.
- (NSProxy *) rootProxy |
Access to the proxy for the object controlling the creating thread.
This method shall be called at least once from the created thread as the first call registers the connection in the thread run loop.
References proxyForObject:inThread:.
- (void) setRootObject: | (id) | anObject |
Set the object controlling the creating thread.
anObject | The controlling object |
- (NSPort *) threadPort |
Accessor to the port of the "thread" end of the connection.
Referenced by MyProcessingThread::threadWithAttributes:.