Messages in this thread |  | | | Date | Sat, 15 Sep 2007 07:54:41 -0700 | | From | "Ray Lee" <> | | Subject | Re: On thread scheduling |
| |
On 9/14/07, Heikki Orsila <shdl@zakalwe.fi> 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.
Are you open to doing something other than pthreads? Using fork() to get real processes, and then sending a SIGSTOP (and SIGCONT) to the one running main() should work.
Or emulating the interrupt arrival with a signal, and having interrupt_handler() be registered as the signal handler. Of course, you then have to deal with the constraints that come with signal handlers, so that can be a bit of a pain depending on what you're trying to do.
Ray - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|  |