chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] Exception when threads are deadlocked?


From: Felix Winkelmann
Subject: Re: [Chicken-users] Exception when threads are deadlocked?
Date: Thu, 05 Aug 2004 14:40:44 +0200
User-agent: Opera M2/7.52 (Win32, build 3834)

On Thu, 05 Aug 2004 14:35:12 +0200, Thomas Chust <address@hidden> wrote:

Hello!

I am doing some network communication in a chicken program and I'm using the srfi-18 unit. In a certain case when a network connection dies unexpectedly, a thread waiting for a condition-variable to be signalled may become deadlocked. Apparently the chicken thread scheduler is quite smart and detects this condition resulting in a warning beeing printed to the screen -- but is there any way to catch that condition in my program and take some action upon it? Is there a special exception type for this condition?

You can catch the exception in the thread that causes the deadlock
(via `handle-exceptions' or `condition-case'). For example:

(define m (make-mutex))
(mutex-lock! m)
(handle-exceptions ex (print "ugh.") (mutex-lock! m))

[I'm not sure whether this is SRFI-18 compliant, but I just wanted
to show handling exceptions]


cheers,
felix




reply via email to

[Prev in Thread] Current Thread [Next in Thread]