[Prev][Next][Index][Thread]

Re: Threads and interrupts



> From: Titus Winters <twinters@odin.ac.hmc.edu>
> Subject: Threads and interrupts
> Date: Mon, 28 Jan 2002 11:12:15 -0800
> 
> Under the OSkit implmentation of pthreads, if I have to grab a mutex
> from within an interrupt (say, to lock access to a buffer) and that
> mutex is locked, will the thread that has the lock get serviced and
> thus allow the interrupt to continue?  I am thinking it does, but
> haven't been able to prove to myself entirely that such is the case.  

Nope, trying to lock a locked mutex from within an true interrupt context
is bad. You either have to block interrupts in the other thread, or arrange
for a thread context to handle the interrupt (interrupt schedules a thread
which locks a mutex).

Look at threads/listener.c to see how to convert a listener callback so
that it runs in a thread context. Its sorta like what you need.

Lbs

----------------------------------------
Leigh B. Stoller
University of Utah - Flux Research Group
http://www.cs.utah.edu/~stoller
----------------------------------------

References: