[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: System asyncs and mutexes: a combination prone to deadlocks
From: |
Ludovic Courtès |
Subject: |
Re: System asyncs and mutexes: a combination prone to deadlocks |
Date: |
Thu, 29 Aug 2013 22:28:50 +0200 |
User-agent: |
Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) |
Mark H Weaver <address@hidden> skribis:
> I wrote:
>> System asyncs can run while mutexes are locked. Asyncs can run
>> arbitrary scheme code, so of course mutexes will often be locked within
>> asyncs as well. So what happens if an async tries to lock a mutex that
>> has already been locked by the same thread? Deadlock, of course.
>
> I've mulled this over, and I think the solution will involve finding all
> of the mutexes that are likely to be locked within asyncs without the
> user's knowledge (i.e. essentially all mutexes used in core Guile, both
> in C and in Scheme), and ensuring that asyncs are disabled before any of
> those mutexes are locked.
>
> What do you think?
(At the risk of looking silly:)
Alternately, what about documenting system asyncs as having restrictions
on the type of code they can run?
For example, can you think of a way to achieve what you wanted in (ice-9
popen) without resorting to system asyncs?
My 2¢,
Ludo’.