[Previous] [Contents] [Index] [Next]

PgShmemCleanup()

Remove shared memory references

Synopsis:

void PgShmemCleanup();

Description:

This function removes all shared memory references defined with PgShmemCreate() and PgShmemAttach(). If the block was created with PgShmemCreate(), the block will be unlinked.

PgShmemCleanup() is called automatically by atexit() when your program terminates normally. If your program terminates abnormally, it should call PgShmemCleanup() explicitly.

Examples:

This code fragment shows how you can use PgShmemCleanup() in a signal handler:

void ExitCleanup( int sig ) {    
    sig = sig;
    PgShmemCleanup();
    _exit( 1 );
}


main( ... ) {
...
    signal( SIGTERM, ExitCleanup );
    signal( SIGHUP, ExitCleanup );
    signal( SIGQUIT, ExitCleanup );
    signal( SIGINT, ExitCleanup );

    /* main loop */
...
}

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgShmemAttach(), PgShmemCreate()

atexit() in the C Library Reference


[Previous] [Contents] [Index] [Next]