Hallo,
this is may be a little bit off-topic, but related to this group.
I'm using shared memory and have to check for in use of the shared memory
regions. This is done by a function eg. put_shm(arg). This returns true on
sucess or false if the resource was busy. Inside the caller I have a construct
like this:
try_cntr = MAX_TRIES;
do {
try_cntr--;
} while(shm_put_SensorLUT(slut) != 0 || try_cntr ==0);
if(try_cntr == 0) {
rtl_printf("Failed to copy %2d times to <%s>\n",
MAX_TRIES, SHM_NAME_SLUT);
}
This looks very complicated for me and I still didn't found a shorter to
program this behavior. How does know one ??
The next question is can I use pthread_mutex for this - generell I would say
yes (it's supportet by rtl-2.2 I believe). The problems is I have to use the
mutex var inside the structure which is copied from/into the shared memory. At
moment the problem is solved by
typedef struct {
doubel um[n];
flag_t inuse;
flag_t valid;
} shm_xx_t;
Thanks Olaf
-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
---
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/