[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Be Specific Signal Handling

The Posix interface for signal handling functions isn't as useful as it could be. The standard indicates that only a single argument (the signal number) is passed to the signal handler. It is useful to have more information and the BeOS provides two extra arguments.
BeOS specific signal defines:
"BeOS signal function handling arguments," describes the pre-defined BeOS signal handling macros.
BeOS signal function handling arguments:
For BeOS we declare the sa_handler field of the sigaction struct as type __signal_func_ptr. That means you'll need to cast any function you assign to the sa_handler field.
NOTE
C++ member functions can not be signal handlers (because they expect a "this" pointer as the first argument).
The 3 arguments that the BeOS provides to signal handlers are as follows:
The vregs struct contains the contents of the volatile registers at the time the signal was delivered to your thread. You can change the fields of the structure. After your signal handler completes, the OS uses this struct to reload the registers for your thread (privileged registers are not loaded of course). The vregs struct is of course terribly machine dependent and is guaranteed to change, potentially even between different models of the PowerPC family. If you use it, you should expect to have to re-work your code when new processors come out. Nonetheless the ability to change the registers does open some interesting programming possibilities.
  struct sigaction {
   __signal_func_ptr sa_handler;
   sigset_t sa_mask;
   int sa_flags;
   void *sa_userdata;
   /*passed to the signal handler*/
  };
BeOS signal flags:
[ First ] [ Previous ] [ Next ] [ Last ] [ Manuals ]
Visit the Metrowerks website at: http://www.metrowerks.com
For assistance contact Metrowerks Technical Support at: cw_support@metrowerks.com
Copyright © 2000, Metrowerks Corp. All rights reserved.
Last updated: August 16, 2000