This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: debugging threads vs processes
- To: jpolsonaz at mac dot com
- Subject: Re: debugging threads vs processes
- From: Cedric Berger <cedric at wireless-networks dot com>
- Date: Fri, 13 Jul 2001 08:51:01 -0700
- CC: tromey at redhat dot com, Jeff Sturm <jsturm at one-point dot com>, Per Bothner <per at bothner dot com>, java-discuss at sources dot redhat dot com
- References: <200107131537.IAA15814@smtpout.mac.com>
jpolsonaz@mac.com wrote:
> Has anybody tried using IBM's new Linux threading library with GCJ?
>
> My personal experience with the currently released LinuxThreads is that
> multi-threaded applications are almost undebuggable. LinuxThreads
> currently has a bug that causes all threads to wakeup from semaphores
> the first time you connect a debugger to the process. This, of course, immediately
> crashes most multi-threaded applications since they don't expect to wake
> up until the semaphore actually gets signaled.
The "wakeup from semaphore" should not be too much of a problem in Java,
because properly written Java never blindly trust "semaphores", but use code
be written this way:
synchronized myFunction() {
while(condition not met)
object.wait(); // this "semaphore" can get glitches, it doesn't matter.
}
Now, of course, if the "mutex" which is used to implements the "synchronized"
keyword itself suffers the same problem, this would be a disaster....
Anyay, I unfortunately agree with your comments.
Cedric