[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Deadlock?

Philip Mak

9/20/2003 6:21:00 PM

Nobu Nokada wrote:
> Mutex uses Thread#stop to wait to be unlocked.

I don't think I'm doing very much with Mutex, though. I only have
these two things:

@@mutex.synchronize do
@@num_sending += 1
end

@@mutex.synchronize do
@@num_sending -= 1
end

Those should be executed fairly quickly, shouldn't they? Since I'm
just incrementing and decrementing a number.

>> Anyone know what to make of this 62.65% time consumption by
>> Thread#stop? Could it be that somehow my threads are deadlocking
>> each other?
>
> Do you define the signal handler?

The only signal handling code in my program is this, which happens in
the main thread:

["SIGTERM", "SIGINT"].each do |sig|
trap(sig) { shutdown }
end

Is that what you're referring to when you say "signal handler"?

1 Answer

nobu.nokada

9/24/2003 11:19:00 AM

0

Hi,

At Sun, 21 Sep 2003 03:21:25 +0900,
Philip Mak wrote:
> Those should be executed fairly quickly, shouldn''t they? Since I''m
> just incrementing and decrementing a number.

Hmmm, seem so. Do you use just one mutex in the application?

> The only signal handling code in my program is this, which happens in
> the main thread:
>
> ["SIGTERM", "SIGINT"].each do |sig|
> trap(sig) { shutdown }
> end

What''s `shutdown''? Doesn''t anything deadlock in it?

--
Nobu Nakada