HP Pascal/HP-UX Release Notes Version A.10.08
Chapter 1 31
New and Changed Features
Making Thread-Safe HP Pascal/HP-UX Routines
Making Thread-Safe HP Pascal/HP-UX
Routines
Kernel threads: Pascal was not thread safed with kernel threads in
mind. Pascal is Thread-Restricted C. Pascal is not fork-safe. Nor
cancellation safe.
User threads: Thread-Safe Performance Constrained/Tuned except for
the limitations in Input/Output listed below which is Thread-Restricted
C. Pascal is not fork-safe. It assumes no cancellations are possible.
There are four major areas of concern when using HP Pascal/HP-UX
multithreaded applications. These concerns are:
• Outer block limitations
• Input/output
• Heap management
• Other libraries (Trap and Unwind libraries)
Not all Pascal routines and constructs that use these features are
thread-safe. For example, Pascal I/O procedures such as APPEND, CLOSE,
READLN, and WRITELN are not thread-safe. Additionally, some string
manipulation code uses the heap for temporary storage.
Outer Block Limitations
HP Pascal/HP-UX multithreaded applications require a non-Pascal (such
as a C or C) outer block.
To convert an existing HP Pascal/HP-UX outer block to C, see Chapter 2
of HP Pascal/HP-UX Programmer's Guide. In particular, the
$SUBPROGRAM$ compiler option must be changed to $EXTERNAL$, and
one module must have the $SUBPROGRAM; GLOBAL$ compiler options.
Otherwise, Pascal modules must be used.
After the outer block is converted, the C outer block must call the routine
documented in the example in Chapter 9, "How To Do Pascal I/O with a
Non-Pascal Outer Block" in HP Pascal/HP-UX.
NOTE Failure to initialize the Pascal Runtime Library with the routine in the
example will probably cause runtime aborts with a NIL pointer.