Resource sem issue

Paolo Mantegazza mantegazza at aero.polimi.it
Thu Oct 28 09:56:51 CEST 2004


Steven Seeger wrote:
> Hey all. I'm using the latest vesuvio with 2.6.8.1 and adeos. I'm not using
> lxrt or xenomai. I'm using the old fashioned stuff with maximum determinism.
> :)
> 
> Anyway, my problem is this. I have two threads accessing a piece of hardware
> via a resource semaphore which I init with rt_typed_sem_init(&sem, 1,
> RES_SEM);
> 
> I have several functions that can be called that need this resource, so
> sometimes multiple rt_sem_wait calls are issued on the same semaphore.
> However, it appears that the nesting is not workign correctly. I have
> confirmed I am making only 2 rt_sem_waits and 2 rt_sem_signals on a
> semaphore, but resource protection is not occuring. I have to add 3
> rt_sem_wait calls to the start of a function to make the thread hang. It
> should only take one.
> 
> I am using rt_sem_wait_if to get the semaphore, and I'm sleeping for the
> system tick time (125 uS) if I don't get it within 15 ticks, I assume
> something is wrong and timeout.
> 
> Is there any reason this should not work?
> 
> This used to work with the previous magma tree.
> 
> If I just use a regular rt_sem_wait call, it behaves correctly.
> 

Just for a test try using LXRT and see what happens.

Paolo.





More information about the Rtai mailing list