Consultor Eletrônico



Kbase 15679: Reasons HLC Code May Be Interrupted by DB Manager Alarms
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/10/1998
Reasons HLC Code May Be Interrupted by DB Manager Alarms

INTRODUCTION
============
This knowledgebase entry discusses how alarm signals
can interrupt HLC code.

WHY YOU NEED TO KNOW THIS
=========================
Changes to alarm signals in Version 7 can cause interrupts
in HLC code to occur more frequently then they did in
Version 6. Changes to Unix releases could also cause
this to occur. HLC code that ran fine on older Unix
releases may get interrupted on a new Unix release.

The database manager uses alarms internally for various
purposes. It is possible for these alarm signals to occur
some time after a database operation has been completed.
When this happens, the process can be executing code
anywhere, including hlc code. Normally this has no
visible side effects since the signal handler is called
and it returns control to the interrupted function.

HLC functions can be interrupted by the alarm signals, as
well as by other signals that may occur, such as SIGQUIT or
SIGHUP. If the hlc code is making a "slow system call", it
can be interrupted by signals. In this case, after the
signal handler has been called and it has returned, the
system call my return an error with errno set to EINTR or
EAGAIN.

The system calls that can be interrupted in this way
include ipc (semaphore and message queue) operations, read
and write operations on slow devices, etc. Note that reads
and writes on slow devices may be partially completed and
some data transferred already when they are interrupted.
Alarm signals are the most likely but not the only ones
that can occur.

PROCEDURAL APPROACH
===================
You should always check return codes for every system
call. Most, but not all, system calls return -1 when an
error has occurred. When an error has occurred, the value
of the global variable errno will indicate the nature of
the error. You should check the man page for the system
call to find out what return value indicates an error and
what values of errno can occur. Those error conditions
that can be handled with should be dealt with in your
program.


Progress Software Technical Support Note # 15679