[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-rt
Subject:    Re: [rtl] thread runs twice?
From:       Ken Teh <teh () phy ! anl ! gov>
Date:       2001-03-28 16:28:05
[Download RAW message or body]

Hello Michael,

The thread does not run twice.  It's my fault that it appears this way.
Incidentally, it was 3.0.

Ken


On Fri, 23 Mar 2001, Michael Barabanov wrote:

> Ken,
>
> Which version of RTLinux do you use?
>
> Michael.
>
> Ken Teh (teh@phy.anl.gov) wrote:
> > I apologize if this sounds confused; it's because I am.
> >
> > I'm trying to understand how thread dispatching works.  Using the sound
> > example, I wrote an IRQ handler that does the following:
> >
> > irq_handler()
> > {
> >     clear_hardware_irq();
> >     pulse_output();
> >     rtl_hard_enable_irq(x);
> > }
> >
> > Everything works fine.  I look on my scope and can measure the time between
> > the input pulse that causes the interrupt and the output pulse from
> > pulse_output().
> >
> > >From the same sound example, I then tried a variation where a thread is
> > dispatched from the handler, ie.
> >
> > irq_handler()
> > {
> >     pthread_wakeup_np(thread);
> >     clear_hardware_irq();
> >     rtl_hard_enable_irq(x);
> > }
> >
> > and my thread looks like
> >
> > void *my_thread(void *param)
> > {
> >     rtl_stop_interrupts();
> >     while (1) {
> > 	pthread_suspend_np(pthread_self());
> > 	pulse_output();
> >     }
> > }
> >
> > When I look on the scope I see 2 output pulses about 10usec apart, instead
> > of the expected 1 which I saw with the previous version.  Since I don't have
> > a capture scope where I can freeze, I cannot say for certain there were
> > actually 2 pulses.  But it sure looks this way.  Only way for this to happen
> > is if the thread ran twice.  Not possible, is it?
> >
> > As a afternote, the system cannot be interrupted twice because the input
> > that generated the interrupt is vetoed until I do pulse_output() which
> > removes the veto.  In any case the input rate is too slow.
> >
> > -- [rtl] ---
> > To unsubscribe:
> > echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
> > echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
> > --
> > For more information on Real-Time Linux see:
> > http://www.rtlinux.org/rtlinux/
>

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail majordomo@rtlinux.org OR
echo "unsubscribe rtl <Your_email>" | mail majordomo@rtlinux.org
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/rtlinux/

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic