On Wed, Sep 03, 2003 at 02:07:10PM -0400, Dan Sugalski wrote: > On Wed, 3 Sep 2003, Leopold Toetsch wrote: > > > Dan Sugalski <[EMAIL PROTECTED]> wrote: > > > On Wed, 3 Sep 2003, Leopold Toetsch wrote: > > > > >> But if one thread sets pmc->next_for_GC the next thread might encounter > > >> this PMC later (albeit for this thread at the first time) and think, I've > > >> visited this PMC already and just flush out the object ID and not the > > >> whole PMC. > > > > > The freezing routine can just lock the PMCs as it freezes them. As long as > > > it keeps the original chain head around, it can then just walk the list > > > again and unlock them. > > > > Then we might get deadlocks. > > This is always a possibility, and there isn't anything we can do about it > at the interpreter level. Deadlocks are an unfortunate fact of life in a > threaded environment.
Can we at least detect this class of deadlock? (which I think is where two threads are simultaneously freezing, but walk the shared objects in a different order, so that thread 0 has already locked object A and is waiting on B, while thread 1 has B locked and is waiting on A) If so, does that help? Is this a stupid question which demonstrates my lack of knowledge about threads? Nicholas Clark