Shm Functions

Name

Shm Functions -- functions for manipulating shared memory independantly of the platform (Linux/Win32).

Synopsis

#include <tiffep.h> (shm.h)


Types

Linux:
#define     SHM_NAME                         "/tmp"
typedef     int                              ShmId;

Win32:
#define     SHM_NAME                         "TiFFEP"
typedef     HANDLE                           ShmId;

struct      Shm;


Internal functions

gint        shm_create                       (Shm *s, const char *name, 
                                              int option);
gint        shm_attach                       (Shm *s, gint option);
gint        shm_detach                       (Shm *s);
gint        shm_destroy                      (Shm *s);
gint        shm_is_exist                     ();

Description

These functions provides a simplified use of shared memory segments independantly of the platform.

Details

struct Shm

struct Shm
{
  gint size;
  ShmId id;
  void* data;
};

The Shm struct is a data structure containing informations about an attached memory segment.
The data field is a pointer of the shared memory segment.


shm_create ()

gint        shm_create                       (Shm *s, const char *name, 
                                              int option);

Create a unique shared memory segment.

 
s : the shm descriptor
option :
unused for the moment
Returns : 0 if success, an error code otherwise