Caution: This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs.

PgShmemCreate()

Create a block of shared memory

Synopsis:

void *PgShmemCreate( unsigned long size,
                     char const *name );

Library:

ph

Description:

This function creates a block of shared memory. The size argument determines the size of the block.

If you pass name as NULL, this function generates a unique name in the form Pg########; this is the preferred mode of operation. If you pass a name, make sure that it isn't already in use.


Note: You must use the “mx” form of a draw function to pass the shared memory reference. Otherwise, the data is copied into the draw event.

The Photon library uses atexit() to arrange for PgShmemCleanup() to be called when your program terminates normally. If your program terminates abnormally, it should call PgShmemCleanup() explicitly.

Returns:

A local pointer to shared memory. If an error occurs, it returns NULL and sets errno.

Errors:

See the errors for shm_open() in the QNX Neutrino Library Reference.

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PgDrawBitmapmx(), PgDrawImagemx(), PgShmemAttach(), PgShmemCleanup(), PgShmemDestroy(), PgShmemDetach()

shm_open() in the QNX Neutrino Library Reference