--- libaitsess/inc/aitsess.h 2008/09/30 20:19:48 1.1.1.1.2.1 +++ libaitsess/inc/aitsess.h 2008/10/13 18:22:01 1.1.1.1.2.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitsess.h,v 1.1.1.1.2.1 2008/09/30 20:19:48 misho Exp $ +* $Id: aitsess.h,v 1.1.1.1.2.3 2008/10/13 18:22:01 misho Exp $ * *************************************************************************/ #ifndef __AITSESS_H @@ -126,6 +126,14 @@ inline void *ipc_attachSession(tagSess * __restrict s, inline void ipc_detachSession(tagSess * __restrict s); /* + * isAttached() Check for mapped/(attached) shared memory + * @s = Session item + * return: -1 null session item, 0 not attached, 1 attached memory +*/ +inline int isAttached(tagSess * __restrict s); + + +/* * map_notSemaphore() MMAP negative block if semaphore isn`t signaled * @s = Session item */ @@ -173,13 +181,14 @@ inline int ipc_addSemaphore(tagSess * __restrict s); */ inline int ipc_decSemaphore(tagSess * __restrict s); + // --------------------------------------------------------- // // Lazy macros for lazy programmers :-) by Michael Pounov; Optimizing work with sessions! // #define DESTROY_SESSION(fname, s) do { \ - switch ((s)->type) { \ + switch (((*s))->type) { \ case SHARED_IPC: \ ipc_destroySession((fname), (s)); \ break; \ @@ -189,13 +198,13 @@ inline int ipc_decSemaphore(tagSess * __restrict s); } \ } while(0) -#define ATTACH_MEMORY(s, shared) do { \ +#define ATTACH_MEMORY(s) do { \ switch ((s)->type) { \ case SHARED_IPC: \ - (shared) = ipc_attachSession((s), 0); \ + ipc_attachSession((s), 0); \ break; \ case SHARED_MAP: \ - (shared) = map_attachSession((s), 0); \ + map_attachSession((s), 0); \ break; \ } \ } while(0)