Previous Topic Next topic Print topic


COBRT096 fork() called in a multi-threaded process (Fatal)

You have called the operating system's fork() API in a process that has multiple threads, and then called some COBOL functionality in the child process.

When the fork() API is called, the operating system only creates one thread in the child process. If the parent had multiple threads at the time of the fork(), thread synchronisation objects, such as mutexes, may have been locked in another thread, which could lead to deadlocks in the child if the child used those thread synchronisation objects.

The child process can only call COBOL functionality if all of the following are true:
  • The parent has a single thread when the fork() API is called.
  • The parent process does not call any COBOL functionality, either before or after the fork().
  • The child process calls cobinit().
Previous Topic Next topic Print topic