[kaffe] NEWS: GNU Classpath's AWT/Swing now runs on KaffeVM.

Dalibor Topic robilad at kaffe.org
Mon Jun 7 06:20:05 PDT 2004

jserv at linux2.cc.ntu.edu.tw wrote:
> Due to big changes in GNU Classpath of 2004-05-31, I updated my tarball
> to adapt it accordingly. However, there are some notes to be mentioned:
>   (1) javax/swing/JComponent.java uses holdsLock() method in 
>       java.lang.Thread to handle double-buffering, but Kaffe lacks it.
>   (2) Java2D implementation in GNU Classpath makes use of much newer
>       version of Cairo, but the one shipped with some Linux ditributions
>       is a bit old.
> In my tarball, remove-holdslock.diff solves the (1) and (2) can be fixed
> with fix-gtkcairopeer.diff. Another way to solve (1) is to implement it,
> but I have no idea how it should exactly be implemented, so that I did
> a dummy one[1].

Okay, I've implemented holdLock like this in pure java code:

public static boolean holdsLock(Object obj) {
  // use obj.notify to check if the current thread holds
  // the monitor of the object.
  // if it doesn't, notify will throw an exception.
  try {
    // okay, current thread holds lock
    return true;
  catch (IllegalMonitorStateException e) {
    // it doesn't hold the lock
    return false;

I believe it's correct, thought it's not optimal performance wise :)

dalibor topic

More information about the kaffe mailing list