bug-classpath
[Top][All Lists]
Advanced

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

[Bug awt/24495] New: JAWT Lock/Unlock(JNIEnv *env) are not re-entrant (u


From: naur at odense dot kollegienet dot dk
Subject: [Bug awt/24495] New: JAWT Lock/Unlock(JNIEnv *env) are not re-entrant (unlike SUN's implementation)
Date: 23 Oct 2005 20:51:42 -0000

I ran across this problem while testing LWJGL (http://lwjgl.org) with GCJ 4.0.2
on my SUSE 10 laptop.

It seems that the global AWT locking exposed in the JAWT struct in GCJ is not
re-entrant.  While I can't find a specification that defines this lock to be
re-entrant, this behaviour is nevertheless unfortunate since the SUN VM
implementation of the lock is re-entrant. The actual code that triggers this
problem is deep within the LWJGL CVS, but here's a snippet to help me
illustrate the problem:

    JAWT jawt;
    jawt.version = JAWT_VERSION_1_4;
    if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) {
        // error handling
        return;
    }
    jawt.Lock(env);
    // Lock AWT a second time from the same thread will hang if using GCJ
    if (JAWT_GetAWT(env, &jawt) != JNI_TRUE) {
        // error handling
        return;
    }
    jawt.Lock(env);

The second locking attempt from the same thread will succeed on a SUN vm, while
it will hang if running GCJ, indicating that the GCJ implementation is not
re-entrant.

I worked around the problem in LWJGL by keeping track of the thread that "owns"
the AWT lock and a locking count, ensuring that the AWT lock is only grabbed
once, even in the re-entrant case.


-- 
           Summary: JAWT Lock/Unlock(JNIEnv *env) are not re-entrant (unlike
                    SUN's implementation)
           Product: classpath
           Version: unspecified
            Status: UNCONFIRMED
          Severity: minor
          Priority: P2
         Component: awt
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: naur at odense dot kollegienet dot dk


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24495





reply via email to

[Prev in Thread] Current Thread [Next in Thread]