ToolTalk User's Guide

What happens when a message arrives to my application?

When a message arrives to your application, the following occurs:

  1. The file descriptor becomes active.

  2. The Xt main loop breaks out of its select and calls the function registered by the XtAppAddInput call.

  3. The registered function calls tt_message_receive.

    The message is read in and any callbacks associated with the message are run.

  4. The message callback returns.

    • If the message callback returns TT_CALLBACK_PROCESSED, tt_message_receive returns a value of null to the input callback.

    • If the message callback returns TT_CALLBACK_CONTINUE, a Tt_message handle for the message is returned.

  5. The input callback continues with any other processing.

For example, the following input callback:

input_callback(...)
{
     Tt_message m;
     printf ("input callback entered\n");
     m = tt_message_receive();
     printf ("input callback exiting, message handle is %d\n",
             (int)m);
}

and the following message callback:

message_callback(...)
{
     printf("message callback entered\n");
     return TT_CALLBACK_PROCESSED;
}

results in the following output:

input callback entered
message callback entered
input callback exiting, message handle is 0