> 
> 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);

Just a note:

In most of the cases this loop runs down immediately unless shm_put_SensorLUT()
allows other tasks to run. Therefore it is unprobable that the resource
will be freed just while the loop counts down.

So it makes almost no difference what is the initial value of try_cntr.


Gabor
-- [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/

Reply via email to