PgShmemCreate()
Create a block of shared memory
Synopsis:
void *PgShmemCreate( unsigned long size,
char const *name );
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 will generate 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.
![]() |
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. |
PgShmemCleanup() is called automatically by atexit() 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 C Library Reference.
Classification:
Photon
| Safety: | |
|---|---|
| Interrupt handler | No |
| Signal handler | No |
| Thread | No |
See also:
PgDrawBitmapmx(), PgDrawImagemx(), PgShmemAttach(), PgShmemCleanup(), PgShmemDestroy(), PgShmemDetach()

