Re: trouble w/ synchronized close method in PushbackInputStream

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

 



Il giorno ven, 31/10/2008 alle 12.40 -0600, Robert Dodier ha scritto:
> Hi,

> At this point I guess I am inclined to plead for trying to reduce
> the use of synchronization in PushbackInputStream.
> Apparently it is possible to create an implementation of it which
> avoids deadlock; Sun's version seems to be evidence of that.

Hi!

I don't think this is a safe way of resolving bugs, maybe in this case
it is (but I have to look at the code), but avoid the deadlock just by
removing a synchronized block means that the two threads now have a
chance to get in the way of each other's data.

We should instead avoid the deadlock in the first place.

Maybe the problem is caused by some threads doing unrelated things, so
in this case having an object to use as semaphore, instead of "this",
may be of help.

Can you provide an example causing the deadlock?

Cheers,
Mario



[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux