 |
» |
|
|
 |
To initialize and register your process with the initial ToolTalk
session, your application needs to obtain a process identifier (procid).
You can then obtain the file descriptor (fd) that corresponds to
the newly initialized ToolTalk process. The following code sample first initializes and registers
the sample program with the ToolTalk service, and then obtains the
corresponding file descriptor. int ttfd; char *my_procid; /* * Initialize ToolTalk, using the initial default session */ my_procid = tt_open(); /* * obtain the file descriptor that will become active whenever * ToolTalk has a message for this process. */ ttfd = tt_fd();
|
tt_open returns the procid for your process and sets it as
the default procid; tt_fd returns a file descriptor for your current
procid that will become active when a message arrives for your application.  |  |  |  |  | CAUTION: Your application must call tt_open before other tt_
calls are made; otherwise, errors may occur. There are, however,
some exceptions, such as: tt_default_session_set, tt_default_procid,
tt_X_session, tt_netfile_file, tt_file_netfile, tt_host_file_netfile,
and tt_host_netfile_file. |  |  |  |  |
 |  |  |  |  | NOTE: Transparent to an application, the CDE action and data
typing services use ToolTalk to execute message-type actions and
to notify an application when the user has changed an action or
data typing database. To do this, these services automatically register
an application with a ToolTalk session if the application is not
registered, or the service will reuse the procid if the application
is already registered. In general, an application will only want
to register with one ToolTalk session. Consequently, it is recommended
that an application call tt_open before it uses libDtSvc service
functions such as DtDbLoad, DtActionInvoke, or DtDbReloadNotify. |  |  |  |  |
When tt_open is the first call made to the ToolTalk service,
it sets the initial session as the default session. The default
session identifier (sessid) is important to the delivery of ToolTalk
messages. The ToolTalk service automatically fills in the default
sessid if an application does not explicitly set the session message
attribute. If the message is scoped to TT_SESSION, the message will
be delivered to all applications in the default session that have
registered interest in this type of message.
|