amarquee.library/QCreateSharedMessagePort amarquee.library/QCreateSharedMessagePort
NAME
QCreateSharedMessagePort - Creates a shared message port for use with QNew*Session(Async)().
(V52)
SYNOPSIS
#include
struct QSharedMessagePort *QCreateSharedMessagePort(void)
FUNCTION
When a QSession is created, a new message port is automatically
created and a signal bit allocated.
This could lead to problems for some applications that create many
QSessions with either QNewSession, QNewSessionAsync, QNewHostSession,
QNewSocketSession, QNewSocketSessionAsync, QNewSocketServerSession.
The reason is that the number of signal bits that an application can
allocate per process are limited to 16.
To solve this problem you could share one message port and signal bit
between a multiple number of QSessions.
First create the message port with this function. Than pass the returned
pointer to QNewSession(), or the other QNew*Session* functions, in the tag
list by using the tag QSESSION_SHAREDMSGPORT.
All the QMessages sent from the QSessions bound to the shared message port
will arrive at the same message port.
Wait() on the qs_mp field of the QSharedMessagePort.
Look at the qm_Session field of the QMessage to figure out which QSession sent
the QMessage. To free the QMessage you should use FreeQMessage like this:
FreeQMessage(qmess->qm_Session,qmess);
When you have finished using the shared message port delete it with
QDeleteSharedMessagePort();
NOTE
QDetachSession cannot be used on a QSession bound to a shared message port.
Only the same process which created the shared message port may bind the shared message port
to a QSession with the QSESSION_SHAREDMSGPORT tag. And only that process may Wait() and GetMsg()
on the shared message port.
INPUTS
RESULTS
Returns the pointer to a struct QSharedMessagePort on success, or NULL
on failure. (Failure occurs if there is not enough memory, or if the process
are out of signal bits).
EXAMPLE
See the included program AMarqueeSharedMP.c for
a full working example of how to use this function.
AREXX NOTES
QCreateSharedMessagePort() and QDeleteSharedMessagePort() are not implemented
for ARexx.
SEE ALSO
QDeleteSharedMessagePort
Converted on 24 Mar 2002 with RexxDoesAmigaGuide2HTML 2.1e(private) by Michael Ranner.