[kaffe] IllegalMonitorStateException under uClinux

Andrea Scian andrea.scian at wawnet.biz
Tue Sep 9 08:33:02 PDT 2003

Hi all!
I'm still trying to make Kaffe running under uClinux. While it works preatty well using jthreads, now I need to use pthreads (because of native bocking methods).
After resolving a few problem with uClinux pthread support now I'm running a simple threading example (source code attached) that simple spawn a few threads, each one of them doing a System.out.println inside a loop.
The problem is that while most of the time the program works fine, sometimes (always if I increase the number of thread running) it give me the following message: 

\> env KAFFE_NATIVE_LIBRARY_DIR=/kaffe/jre/lib/arm KAFFE_LIBDIR=/kaffe/lib LIBRARY_PATH=/kaffe/jre/lib/arm LD_LIBRARY_PATH=/kaffe/jre/lib/arm /kaffe/jre/bin/kaffe-bin -mx7M -ms7M -as1k  MultiThreadDemo

New thread: Thread[One,5,main]
New thread: Thread[Two,5,main]
One: 50
One: 49
Two: 50
New thread: Thread[Three,5,main]
One: 48
Two: 49
One: 47New thread: Thread[Four,5,main]

Two: 48
Three: 50
Three: 49java.lang.IllegalMonitorStateException
        at java.io.PrintStream.println(PrintStream.java:123)
New thread: Thread[Five,5,main]
Four: 50
Three: 48
Two: 47
Four: 49        at NewThread.run(MultiThreadDemo.java:17)
        at java.lang.Thread.run(Thread.java:334)

New thread: Thread[Six,5,main]Three: 47
Five: 50
Three: 46

Five: 49
Two: 46
New thread: Thread[Seven,5,main]
Five: 48
Main: 50
Five: 47
[a few line after]
Five: 37

Main: 42
Five: 36
Two: 38
Main: 41
Two: 37
Seven: 41
Five: 35
Seven: 40
Two: 36Main: 40 at java.io.PrintStream.println(PrintStream.java:123)

Five: 34

Main: 39
        at NewThread.run(MultiThreadDemo.java:17)
Seven: 39
Main: 38        at java.lang.Thread.run(Thread.java:334)

Five: 33
Main: 37
Seven: 38
Seven: 37
        at java.io.PrintStream.println(PrintStream.java:123)
        at NewThread.run(MultiThreadDemo.java:17)Main: 36

        at java.lang.Thread.run(Thread.java:334)
Seven: 36
Five: 32
Main: 35
Seven: 35
Main: 34
Five: 31
Seven: 34
Main: 33
Seven: 33
Five: 30
Main: 32
Five: 29
Seven: 32       at java.io.PrintStream.println(PrintStream.java:123)

Five: 28
Seven: 31
        at NewThread.run(MultiThreadDemo.java:17)Main: 31

        at java.lang.Thread.run(Thread.java:334)
        at java.io.PrintStream.println(PrintStream.java:123)
        at NewThread.run(MultiThreadDemo.java:17)Five: 27
Seven: 30
Five: 26

        at java.lang.Thread.run(Thread.java:334)
Seven: 29
Five: 25

Can anybody tell me if the problem is in my Kaffe build or in the uClinux pthread implementation? I mean did some of you enconter this error before (under linux or any other system)? Where could it come frome?

Thank you in advance!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://kaffe.org/pipermail/kaffe/attachments/20030909/8feb8bcc/attachment-0007.htm 

More information about the kaffe mailing list