dvi2bitmap dvi2bitmap1.0

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Namespace List
- Namespace Members

Classes | Functions | Variables
PipeStreamSignalHandling Namespace Reference

Takes care of the signal handling necessary for the functions in the PipeStream class. More...

## Classes
struct | process_status

## Functions
bool | got_status (pid_t pid, int *status)
| Checks to see if the given process has exited. More...
void | expectAnother () throw (InputByteStreamError)
| Note that we expect to start another child. More...
void | childcatcher (int)
void | alarmcatcher (int)

## Variables
struct process_status * | procs = 0
sig_atomic_t | nprocs
sig_atomic_t | nprocs_used

## Detailed Description

Takes care of the signal handling necessary for the functions in the PipeStream class.

If your application for whatever reason has to catch `SIGCHLD`, then to avoid interference between these, you should do so using functions expectAnother and got_status. These two functions are the only `public' API in this namespace.

## Function Documentation

void PipeStreamSignalHandling::alarmcatcher | ( | int | signum) |  |

Referenced by expectAnother().

void PipeStreamSignalHandling::childcatcher | ( | int | signum) |  |

References nprocs, nprocs_used, PipeStreamSignalHandling::process_status::pid, procs, and PipeStreamSignalHandling::process_status::status.

Referenced by expectAnother().

void PipeStreamSignalHandling::expectAnother | ( | ) |  |
throw | ( | InputByteStreamError
| ) |  |

Note that we expect to start another child.

This function must be called before doing each `fork()`, as it does the initialisation of the structures used by this set of functions, and subsequently ensures that there is enough space in the list of statuses to hold another one.

Exceptions

  InputByteStreamError | if we can't do this for some reason

References alarmcatcher(), childcatcher(), InputByteStream::getVerbosity(), normal, nprocs, nprocs_used, and procs.

Referenced by PipeStream::PipeStream().

bool PipeStreamSignalHandling::got_status | ( | pid_t | pid,
|  | int * | status
| ) |  |

Checks to see if the given process has exited.

If there's an entry for this PID in the list, then put the corresponding status in the `status` parameter, and return true. If not, return false; `*status` is then unchanged.

Parameters

  pid | the PID to check
  status | a pointer to the status to be returned

Returns
  true if the status was in fact available, and is now in `*status`; false otherwise

References PipeStreamSignalHandling::process_status::clear(), InputByteStream::getVerbosity(), normal, nprocs, nprocs_used, procs, and PipeStreamSignalHandling::process_status::status.

Referenced by PipeStream::close().

## Variable Documentation

sig_atomic_t PipeStreamSignalHandling::nprocs

Referenced by childcatcher(), expectAnother(), and got_status().

sig_atomic_t PipeStreamSignalHandling::nprocs_used

Referenced by childcatcher(), expectAnother(), and got_status().

struct process_status* PipeStreamSignalHandling::procs = 0

Referenced by childcatcher(), expectAnother(), and got_status().