Full asynchronous mode is identical to the simple asynchronous mode except in the way the Creo Object
TOOLKIT C++ application handles requests from Creo Parametric. In simple asynchronous mode, it is not possible to process these requests. In full asynchronous mode, the application implements
a control loop that ‘listens’ for messages from Creo Parametric. As a result, Creo Parametric can call functions in the application, including callback functions for menu buttons and notifications.
Note
Using full asynchronous mode requires starting or connecting to Creo Parametric using the methods described in the previous sections. The difference is that the application must provide an event loop to
process calls from menu buttons and listeners.
Methods Introduced:
The control loop of an application running in full asynchronous mode must contain a call to the method
pfcAsyncConnection::EventProcess, which takes no arguments. This method allows the application to respond to messages sent from
Creo Parametric. For example, if the user selects a menu button that is added by your application,
pfcAsyncConnection::EventProcess processes the call to your listener and returns when the call completes. For more information on listeners and adding menu
buttons, see the
Session Objects section.
The method pfcAsyncConnection::WaitForEvents provides an alternative to the development of an event processing loop in a full asynchronous mode application. Call this
function to have the application wait in a loop for events to be passed from Creo Parametric. No other processing takes place while the application is waiting. The loop continues until pfcAsyncConnection::InterruptEventProcessing is called from a Creo Object
TOOLKIT C++ callback action, or until the application detects the termination of Creo Parametric.
It is often necessary for your full asynchronous application to be notified of the termination of the Creo Parametric process. In particular, your control loop need not continue to listen for Creo Parametric messages if Creo Parametric is no longer running.
An AsyncConnection object can be assigned an Action Listener to bind a termination action that is executed upon the termination of Creo Parametric. The method pfcAsyncActionListener::OnTerminate handles the termination that you must override. It sends a member of the class pfcAsyncConnection::TerminationStatus, which is one of the following:
|
• |
pfcTERM_EXIT—Normal exit (the user clicks Exit on the menu). |
|
• |
pfcTERM_ABNORMAL—Quit with error status. |
|
• |
pfcTERM_SIGNAL—Fatal signal raised. |
Your application can interpret the termination type and take appropriate action. For more information on Action Listeners,
see the
Action Listeners section.