#39 Patch to stop pthread lock/cond_wait blocking

Ian Rogers

This patch fixes the AWT in the case of 1 virtual
processor. It overrides the pthread_mutex_lock and
pthread_cond_wait functions with version that call back
into the JVM yield. In the case of the lock if the lock
can't be obtained, in the case of cond_wait if the wait
times out (the value set at 1 second). There are
clearly other bugs with the AWT (quit doesn't seem to
force windows to close, > 1 virtual processor will
bring about eventual deadlock) but I think this patch
is small and uncontroversial enough that it can be
applied as a fix with the other problems to be solved
later. The cond_wait code is seldom exercised unless
there is >1 VM_Processor.

Efforts at working around these other problems have
been tackled by making JNI entry yield until the
VM_Processor only had 1 thread in native code, trying
to preempt native threads so that they'd cause the
processor to schedule a thread other than the current
native one, altering the classpath library so it was
less likely to block. Of these, this patch achieves as
much functionality without requiring changes to
classpath. For the other code see the mail archives and
the previous closed patch #1444139.


I, Ian Rogers:

(a) represent that either:

(i) I am the only author and owner of the contributed
(described as/entitled Patch to stop pthread
lock/cond_wait blocking
which was neither derived nor copied from any
other software,

(ii) that any exception to (i) is software which was
obtained under the
CPL (Common Public License),


(b) hereby agree to license this contributed software
under the CPL.

If this patch gets applied I think bug #1147592 should
be closed.

I think I deserve some chocolate for fixing this ;-)

Regards, Ian


  • Ian Rogers

    Ian Rogers - 2006-03-15

    Diff against current CVS repository. Changes to stop portable native sync (broken) and then the pthread overrides in syswrap.C

  • Dave Grove

    Dave Grove - 2006-03-17

    Logged In: YES

    sorry for the slow response; it's been one of those weeks.

    Looked through the patch and it seems plausible. Running
    some regression tests now.

    Yep, next time we're at the same conference I owe you either
    chocolate or a beer; your choice.

  • Dave Grove

    Dave Grove - 2006-03-19

    Logged In: YES

    committed with 1 delta to the changes in jBuildClasspathJar
    to correctly detect when gtk-devl packages are not present
    on machine building classpath libraries.

  • Ian Rogers

    Ian Rogers - 2006-03-20

    Logged In: YES

    Hi Dave,

    Could you patch jBuildClasspathJar so that it detects gtk.h
    when its installed in /opt/gnome/include/gtk-2.0/gtk/gtk.h
    as this is the default for OpenSuSE. My || test was supposed
    to catch this, but I think it has a problem. Thanks,


  • Dave Grove

    Dave Grove - 2006-03-20

    Logged In: YES

    committed an attempt; let me know if it works (all our linux
    machines are RHEL 4 so I couldn't try directly).

  • Ian Rogers

    Ian Rogers - 2006-03-21

    Logged In: YES

    Thanks Dave, tested the patch and it works.



Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks