PtAppAddSignalProc()

Add Photon signalling to a context

Synopsis:

int PtAppAddSignalProc( PtAppContext_t app, 
                        sigset_t const *set,
                        PtSignalProc_t func, 
                        void *data);

Library:

ph

Description:

This function adds Photon signal handling to the context app.

The app argument is the address of the application context, a structure that manages all the data associated with this application. This must be specified as NULL, so that the default context is used.

All signals in the set set are trapped and directed to a function that synchronizes with the Photon widget library and, at the next safe point, invokes the user-supplied function func().

The user callback function is declared as follows:

int func(int signal, void *data)

You can declare the function to be of type PtSignalProcF_t to take advantage of the compiler's type-checking.

It's invoked with the signal number and user data as parameters. It should return Pt_CONTINUE to remain installed, or Pt_END to have the callback removed for this signal.

You can add more than one function for a set of signals or set of intersecting signals. All handlers for a signal are called, but the order they're called in is unspecified.

The Photon widget library isn't signal-safe—normal signal handling functions must not call Photon library functions or alter Photon globals. Because this mechanism synchronizes with the widget library before calling the user function, no such limitations are placed on processing within handler functions installed via this routine.

Returns:

0
Success.
-1
An error occurred.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtAppRemoveSignal()

Interprocess Communication in the Photon Programmer's Guide