Rate This Document
Findability
Accuracy
Completeness
Readability

HTL_thread_atfork

Registers the fork handler.

Interface Definition

int HTL_thread_atfork(void (*prepare)(void), void (*parent)(void), void (*child)(void));

Description

HTL_thread_atfork() is invoked before fork() to specify the prepare, parent, and child functions during fork processing.

Parameters

Parameter

Type

Description

Input/Output

prepare

void (*prepare)(void)

Handler that is executed before fork processing.

Input

parent

void (*parent)(void)

Handler that is executed in the parent process after the fork processing is complete.

Input

child

void (*child)(void)

Handler that is executed in the child process after the fork processing is complete.

Input

Return Value

  • HTL_THREAD_SUCCESS: success.
  • Other values: failure. For details, see the error code descriptions.

Example

    static void atfork_prepare(void) {
      ....
    }

    static void atfork_parent(void) {
        ...
    }   


    static void atfork_child(void) {
      ...
    }

    int status = pthread_atfork(atfork_prepare, atfork_parent, atfork_child);