Use pthread_kill(thread,RTL_SIG_WAKEUP)  instead of wakeup_np.
Wakeup_np will call the scheduler and, if the current thread is lower
priority, it will switch !
Remember, a signal/interrupt handler executes in the context of 
the running thread, whatever that is.


On Tue, Apr 25, 2000 at 10:56:06AM +0200, [EMAIL PROTECTED] wrote:
> 
> I found a strange thing.
> 
> I have a hardware IRQ handler that wakes up a sleeping task:
> 
> it_handler(.....)
> {
>       ...
>       rtl_printf("checkpoint 1\n");
>       if (waiting_thread) pthread_wakeup_np(waiting_thread);
>       rtl_printf("checkpoint 2\n");
>       ...
> }
> 
> 
> user_thread(...)
> {
> 
>       ...
>       rtl_no_interrupts(flags);
>       waiting_thread = pthread_self();
>       pthread_make_periodic_np(waiting_thread, sometime, 0);
>       pthread_wait_np();
>       rtl_printf("checkpoint 3\n");
>       waiting_thread = NULL;
>       rtl_restore_interrupts(flags);
>       ...
> }
> 
> Diagnostic printf-s show that the executing order is 1-3-2.
> This means, that priority of interrupt handler thread is not
> definitely higher than priority of the normal thread.
> When pthread_wakeup_np() reschedules threads, user_thread
> gets the control instead of it_handler.
> 
> I could accept this if priority of an IRQ handler would be _well-known_
> or could be set.
> But in lack of documentation one may think that it has
> the highest possible priority and no user created threads can beat it.
> 
> What is the matter?
> 
> 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/

-- 
---------------------------------------------------------
Victor Yodaiken 
FSMLabs:  www.fsmlabs.com  www.rtlinux.com
FSMLabs is a servicemark and a service of 
VJY Associates L.L.C, New Mexico.

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