LynkeosThreadConnection Class Reference
[Support classes]

This class implements a connection between threads in the same adress space. More...

#import <LynkeosThreadConnection.h>

Inheritance diagram for LynkeosThreadConnection:

Inheritance graph
[legend]
Collaboration diagram for LynkeosThreadConnection:

Collaboration graph
[legend]

List of all members.

Public Member Functions

(NSPort *) - mainPort
 Accessor to the port of the "main" end of the connection.
(NSPort *) - threadPort
 Accessor to the port of the "thread" end of the connection.
(BOOL) - connectionIdle
 Check wether some message remains to be processed.
(NSProxy *) - proxyForObject:inThread:
 Creation of a proxy for the object controlling one thread.
(void) - setRootObject:
 Set the object controlling the creating thread.
(NSProxy *) - rootProxy
 Access to the proxy for the object controlling the creating thread.
(id) - initWithMainPort:threadPort:
 Connection initialization.
(id) - initWithMainPort:threadPort:queueSize:
 Connection initialization.

Static Public Member Functions

(void) + performSelectorOnMainThread:forObject:withArg:
 Call a selector on an object on the main thread.


Detailed Description

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.


Member Function Documentation

- (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.

Returns:
YES if no message is waiting to be processed

- (id) initWithMainPort: (NSPort*)  mainPort
threadPort: (NSPort*)  threadPort 

Connection initialization.

Parameters:
mainPort The port of the creating thread
threadPort The port for the created thread
Returns:
The new connection

- (id) initWithMainPort: (NSPort*)  mainPort
threadPort: (NSPort*)  threadPort
queueSize: (int)  queueSize 

Connection initialization.

Parameters:
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
Returns:
The new connection

- (NSPort *) mainPort  

Accessor to the port of the "main" end of the connection.

Returns:
The port

References LynkeosThreadCnxEnd::_port.

+ (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.

Parameters:
sel The selector to perform
target The target object
arg The only argument of the method being called

References LynkeosThreadConnection(QueueMgt)::sendInvocation:inThread:.

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.

Parameters:
object The controlling object
inThread Selects the created thread if YES
Returns:
The proxy for the object controlling the requested thread

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.

Returns:
The proxy for the object controlling the creating thread

References proxyForObject:inThread:.

- (void) setRootObject: (id)  anObject  

Set the object controlling the creating thread.

Parameters:
anObject The controlling object

- (NSPort *) threadPort  

Accessor to the port of the "thread" end of the connection.

Returns:
The port

References LynkeosThreadCnxEnd::_port.

Referenced by MyProcessingThread::threadWithAttributes:.


The documentation for this class was generated from the following files:

Generated on Fri Dec 19 16:35:36 2008 for Lynkeos by  doxygen 1.5.7.1