Middleware, development tools, realtime operating system
software and services for superior embedded design


Home
QNX Community Resources
QNX Documentation Library
PtAppAddCallback

PtAppAddCallback

QNX Software Systems
Developer Resources
Blogs
Board support packages
Foundry27 projects
Forums
Hardware support listing
Online video tutorials
Product documentation
Technical Articles

PtAppAddCallback()

Add a callback to an application's callback list

Synopsis:

void PtAppAddCallback(
        unsigned long cb_type,
        int (*func)(void*,PtCallbackInfo_t*),
        void *data );

Arguments:

cb_type
The name of the callback list you want to add the function to. For example, Pt_CB_APP_EXIT.
func
A pointer to the function you want to add. The function takes this form: int (*func)(PtCallbackInfo_t *, void *).
data
A pointer to data that you want to pass as the second argument to the function.

Library:

ph

Description:

This function adds a callback to the application's callback list. For a list of application callbacks, see PtAppSetResources().

For more information, see the Manipulating Resources in Application Code chapter of the Photon Programmer's Guide.

Returns:

0
Success.
-1
An error occurred.

Examples:

int exit_cb(void *data,
               PtCallbackInfo_t *cbinfo)
{
  printf( "I\'m exiting\n" );
  return( Pt_CONTINUE );
};
...
PtAppAddCallback(Pt_CB_APP_EXIT, exit_cb, NULL);

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtAppGetResources(), PtAppGetResource(), PtAppRemoveCallback(), PtAppSetResource(), PtAppSetResources(), PtSetArg().