From: Kyle Moffett <mrmacman_g4@mac.com>
To: Heikki Orsila <shdl@zakalwe.fi>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: On thread scheduling
Date: Sun, 16 Sep 2007 03:16:52 -0400 [thread overview]
Message-ID: <E1A87DCE-4438-45B8-87CB-8BB55C9F4149@mac.com> (raw)
In-Reply-To: <20070914224000.GI3400@zakalwe.fi>
On Sep 14, 2007, at 18:40:00, Heikki Orsila wrote:
> Consider a simple embedded system:
>
> void interrupt_handler(void)
> int main(void)
>
> I would like to "emulate" this system with a workstation to make
> development faster. I would create two threads, one executing the
> main() function, and the other occasionally calling
> interrupt_handler(). Before interrupt_handler() is called, the main
> () thread should be stopped asynchronously.
Actually you probably just want to do this with an ordinary single-
threaded program. Just do your main() thing normally and schedule a
signal-based timer at program start (or whenever you actually set up
your periodic interrupt source); the timer signal-handler will act
as the interrupt handler. Alternatively you could have 2 threads
where the *only* thing the second thread does is a timed poll() loop
on an FD where it reads commands from the main thread. When the main
thread wants to change the interval-between-interrupts or some other
interrupt configuration it writes the info down the FD to the
alternate thread which actually sets up the change. The main program
then continues running and periodically receives its SIGUSR1 or
whatever from the other thread and uses that as the interrupt.
Cheers,
Kyle Moffett
prev parent reply other threads:[~2007-09-16 7:17 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-09-14 22:40 Heikki Orsila
2007-09-15 5:39 ` Matthias Kaehlcke
2007-09-15 14:54 ` Ray Lee
2007-09-16 7:16 ` Kyle Moffett [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1A87DCE-4438-45B8-87CB-8BB55C9F4149@mac.com \
--to=mrmacman_g4@mac.com \
--cc=linux-kernel@vger.kernel.org \
--cc=shdl@zakalwe.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®