Open System Services Programmer's Guide

Converting 32-Bit Applications to 64-Bit Applications................................................................307
Step 1: Identify Programs that Need to be Compiled in the LP64 Data Model..........................307
Step 2: Identify Non-Portable Constructs..............................................................................307
Step 3: Using the C/C++ Compiler to Identify Needed Source Code Changes........................307
Step 4: Compile in the LP64 Data Model............................................................................310
64-Bit TNS/E Debugger Support............................................................................................310
Tool Control Language (TCL) Support..................................................................................311
Snapshot Support............................................................................................................311
eInspect Support..............................................................................................................312
eGarth Support...............................................................................................................312
Visual Inspect Support......................................................................................................312
12 Using the Standard POSIX Threads Library...............................................313
Standard POSIX Threads........................................................................................................313
Compiling and Linking Considerations................................................................................314
Error Reporting Changed From Previous Standard................................................................314
Attributes Defined by Threads Macros ................................................................................315
Signal Handling..............................................................................................................315
Thread-Aware Signal Handling..........................................................................................317
Threads Portability...........................................................................................................327
Numerical Limits in Standard POSIX Threads.......................................................................327
Keeping Application Design Simple....................................................................................328
Threading Considerations......................................................................................................328
Sharing Process Resources................................................................................................328
Using Standard Libraries...................................................................................................328
Addressing the Thread Stack.............................................................................................329
Making Process-Blocking Calls...........................................................................................329
Using Nowait Input or Output............................................................................................329
Yielding Control...............................................................................................................330
Using Signals..................................................................................................................330
Spawning a New Process.................................................................................................331
Isolating Faults.................................................................................................................331
Single Versus Multiple Application Threads..............................................................................331
Programs With a Single Application Thread........................................................................331
Programs With Multiple Independent Application Threads.....................................................332
Programs With Multiple Interdependent Application Threads.................................................332
Jacket Routines.....................................................................................................................333
SERVERCLASS_SEND and SERVERCLASS_SENDL Jacket Routines...........................................333
SERVERCLASS_DIALOG Jacket Routines..............................................................................334
TMF Transaction Jacket Routines.........................................................................................334
Reference Pages for Thread Functions......................................................................................335
Threaded Application Examples.............................................................................................335
Thread-Aware and Nonblocking OSS Functions........................................................................340
Regular Files...................................................................................................................341
Non-Regular Files............................................................................................................342
Equivalent System, Thread-Aware, and Nonblocking Thread-Aware Functions...........................343
Preprocessor Directives Automatically Map Standard System Calls to Thread-Aware or Nonblocking
Thread-Aware System Calls...............................................................................................346
Using Thread-Aware Functions...........................................................................................348
Reentrant OSS Functions........................................................................................................365
Example Program Using Reentrant Functions........................................................................367
Thread-Aware Toolkit Functions and Types...........................................................................368
Using Thread-Aware Toolkit Functions.................................................................................369
Caveats to Using the Thread-Aware Toolkit .........................................................................372
Thread-Aware $RECEIVE I/O Functions...............................................................................372
8 Contents