I have a general question about using LXRT with pthreads, and I have a
specific problem about which I'd be grateful to get some ideas.

First, the general question: I have an LXRT process in which I start
multiple threads (using the standard Linux pthread implementation, where
the include file credits Xavier Leroy), and I want to make RTAI calls in
more than 1 thread. Should each thread that will call the RTAI API, call
rt_task_init to have its own RTAI proxy, or is a single call in the main
thread enough ?

And the problem: The reason I ask is I have a problem where rt_sem_wait
does not wait for a non-signaled semaphore. I confirmed (by tracing
rt_sem_... calls in the upscheduler/rtai_sched.c module) that the
semaphore is created with a value of 0 and is never signaled. When
entering rt_sem_wait, sem->count becomes < 0 and rt_schedule is called,
and the same process keeps on running. Since this call was made in a
thread which had not called rt_task_init, I thought that the calling
LXRT task does not have a proxy and does not exist as far as the RT
scheduler is concerned, and so cannot be suspended. So I tried adding a
call to rt_task_init at the beginning of the thread, but the symptoms
did not change.

In simple examples/tests, rt_sem_wait works fine. The problem occurs in
a large body of code (being ported from QNX). I'll try to duplicate it
in stand-alone example code. Meanwhile, does anyone have a hint or a
solution ?

I'm using RTAI1.3, kernel 2.2.14-12, RedHat 6.1.

Francois Desruisseaux,
OPAL-RT Technologies inc,
1751 Richardson, suite 2525,
Montreal (Quebec),
Canada  H3K 1G6
Tel: (514) 935-2323
Fax: (514) 935-4994
www: www.opal-rt.ca
Email: [EMAIL PROTECTED] 
-- [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