Up: Classes   [Index]


SignalEvent

SignalEvent Class

The SignalEvent class provides methods and variable definitions for Ctalk programs to handle signal events.

Signal handler (SignalHandler) methods act like C functions when a program installs them to handle signals. The signal handler methods cannot, in most cases, create objects. Ctalk provides the C function __ctalkNewSignalEventInternal to create and queue SignalEvent objects from the handler.

Here is an example of a signal handler method that creates SignalEvent objects.

#include <time.h>

SignalHandler instanceMethod handleSignal (__c_arg__ int signo) {
  time_t t;
  char buf[MAXLABEL];
  noMethodInit;
  t = time (NULL);
  /* Format the system time, then create a new SignalEvent object,
     and add the time data to the new object's text instance variable. */
  __ctalkDecimalIntegerToASCII (t, buf);
  __ctalkNewSignalEventInternal (signo, getpid (), buf);
  return NULL;
}

For more information, Method functions, and __ctalkNewSignalEventInternal.

Class Variables

pendingEvents

A List of pending signal events.

Instance Variables

processID

An Integer that contains the process ID of the program that received the signal.

sigNo

An Integer that contains the signal number of the handler.

data

A String object that contains data from the signal handler.

Instance Methods

getPID (void)

Set the SignalEvent object’s pid instance variable to the program’s process ID.

new (event1, event2, ... event3;)

Create one or more new SignalEvent objects with the names given in the argument lists.


SignalEvent new event1;
SignalEvent new event1, event2;

nextEvent (void)

Return the next signalEvent object from the class’ pendingEvents queue.

pending (void)

Return TRUE if the class’ pendingEvents queue contains SignalEvent event objects, FALSE otherwise.

queueEvent (void)

Add the receiver to the class’ pendingEvents queue.


Up: Classes   [Index]