next up previous contents FITSIO Home
Next: 2.5 Getting Started with Up: 2. Creating the CFITSIO Previous: 2.3 Linking Programs with   Contents

2.4 Using CFITSIO in Multi-threaded Environments

CFITSIO can be used either with the POSIX pthreads interface or the OpenMP interface for multithreaded parallel programs. When used in a multithreaded environment, the CFITSIO library *must* be built using the -D_REENTRANT compiler directive. This can be done using the following build commands:

  >./configure --enable-reentrant
  > make
Multiple threads can then call any of the CFITSIO routines to read or write separate FITS files. Multiple threads can also read data from the same FITS file simultaneously, but different threads must never try to write to the same FITS file.