[Zope-Coders] Signal forwarding

Jeremy Hylton jeremy@alum.mit.edu
Wed, 9 Oct 2002 21:59:46 -0400


>>>>> "CM" == Chris McDonough <chrism@zope.com> writes:

  CM> On Wed, 2002-10-09 at 17:06, Jeremy Hylton wrote: So the problem
  CM> would be that if some other piece of code already held the lock,
  CM> it could result in deadlock?
  >>
  >> That's right.  Take FileStorage as an example.  A bunch of its
  >> methods acquire a lock on entry and release it on exit.  If any
  >> of these methods is being executed when the signal handler
  >> executes, the attempt to acquire the lock for pack will block
  >> forever.

  CM> What would cause the method to not finish?  It's running in a
  CM> separate thread, no?  Is its execution held up as a result of
  CM> the signal?

It's just a question of luck.  What if the thread that holds the lock
is also the thread that runs the signal handler?  That thread can't
wait fot itself.

Jeremy