Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Sharable sessions

A session can be shared by threads provided the server is marked as supporting shared sessions.


Sharing

Once a server has started, and a client has connected to that server (by creating a session), then the client thread can make the session sharable. There are two types of sharing:

A server must support the creation of sharable sessions, otherwise an attempt to make a session sharable panics the calling thread. Servers can be created to be either unsharable, sharable among threads in the same process, or sharable among all threads in the system.


Sharing a session among threads in a single process

There are two ways of doing this:


Sharing a session among threads across all processes

There are two ways of doing this:

[Top]


Server exit

If the server terminates, all outstanding messages which have been sent to it are completed with a KErrServerTerminated code. Any attempt to send further messages, or to share session, fail immediately with KErrServerTerminated. The only valid operation on such a session is to close it.

[Top]


Session closure

If Close() is called on a session, any outstanding messages on the session may not be completed for the client. Following this, the only message that the server receives from the session is the disconnect message.

[Top]


Client thread exit

If a session has not been shared, then the session is closed as part of normal thread cleanup.

If a session has been shared, the session handle is owned by the process and is not automatically cleaned up with the thread. In addition, the server is not informed that the thread has terminated.

The only way to free resources owned by the session is to explicitly close the session, or to terminate the client process. Note that this makes it possible for a session to have no client threads !

[Top]


Message slots

The maximum number of message slots that can be allocated to a session, or the maximum number that can be dynamically acquired from the system-wide pool, is 255.