mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-23 00:43:28 +00:00
The BSD patchset for the Sun JDK modeled its thread behavior mostly after
existing the Solaris base, and similarly to what happened with NSPR, made a bad assumption on undefined behavior. This broke locking in various places in Java, for example, causing the the debugging support to be totally broken. It is worth someone who knows the Java codebase taking a look to see what other things could have been broken by this on FreeBSD 5.x+. The assumption is that pthread_mutex_trylock(3) on a default-type mutex will fail with EBUSY. This assumption is wrong for our libpthread, which returns EDEADLK if the owner thread is trying to acquire the mutex again with trylock. The behavior of performing a locking operation on a self-locked default-type mutex is explicitly undefined for pthread_mutex_lock(3). The POSIX specification is still not very clear. It defines pthread_mutex_trylock(3) in terms of pthread_mutex_lock(3) yet does not say what the defined behavior should be for a self-locked pthread_mutex_trylock(3) for any of the various mutex types, so it is ambiguous whether the result is clearly undefined or clearly to return EBUSY. It is a one line change whether or not to make libpthread return EDEADLK in this case, where it seems that most implementations do not. Reference: http://www.opengroup.org/onlinepubs/009695399/functions/pthread_mutex_lock.html
This commit is contained in:
parent
836157323e
commit
52602010f0
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=119887
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= jdk
|
||||
PORTVERSION= ${JDK_VERSION}p${JDK_PATCHSET_VERSION}
|
||||
PORTREVISION= 5
|
||||
PORTREVISION= 6
|
||||
CATEGORIES= java devel
|
||||
MASTER_SITES= # http://www.sun.com/software/java2/download.html
|
||||
# http://www.eyesbeyond.com/freebsddom/java/jdk14.html
|
||||
|
13
java/jdk14/files/patch-vm::os_bsd.hpp
Normal file
13
java/jdk14/files/patch-vm::os_bsd.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- ../../hotspot/src/os/bsd/vm/os_bsd.hpp.orig Wed Oct 20 16:01:08 2004
|
||||
+++ ../../hotspot/src/os/bsd/vm/os_bsd.hpp Wed Oct 20 16:01:30 2004
|
||||
@@ -353,7 +353,7 @@
|
||||
bool trylock() {
|
||||
verify();
|
||||
int status = pthread_mutex_trylock(_mutex);
|
||||
- if (status == EBUSY)
|
||||
+ if (status == EBUSY || status == EDEADLK)
|
||||
return false;
|
||||
assert(status == 0, "pthread_mutex_trylock");
|
||||
#ifndef PRODUCT
|
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= jdk
|
||||
PORTVERSION= ${JDK_VERSION}p${JDK_PATCHSET_VERSION}
|
||||
PORTREVISION= 5
|
||||
PORTREVISION= 6
|
||||
CATEGORIES= java devel
|
||||
MASTER_SITES= # http://www.sun.com/software/java2/download.html
|
||||
# http://www.eyesbeyond.com/freebsddom/java/jdk14.html
|
||||
|
13
java/jdk15/files/patch-vm::os_bsd.hpp
Normal file
13
java/jdk15/files/patch-vm::os_bsd.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- ../../hotspot/src/os/bsd/vm/os_bsd.hpp.orig Wed Oct 20 16:01:08 2004
|
||||
+++ ../../hotspot/src/os/bsd/vm/os_bsd.hpp Wed Oct 20 16:01:30 2004
|
||||
@@ -353,7 +353,7 @@
|
||||
bool trylock() {
|
||||
verify();
|
||||
int status = pthread_mutex_trylock(_mutex);
|
||||
- if (status == EBUSY)
|
||||
+ if (status == EBUSY || status == EDEADLK)
|
||||
return false;
|
||||
assert(status == 0, "pthread_mutex_trylock");
|
||||
#ifndef PRODUCT
|
@ -7,7 +7,7 @@
|
||||
|
||||
PORTNAME= jdk
|
||||
PORTVERSION= ${JDK_VERSION}p${JDK_PATCHSET_VERSION}
|
||||
PORTREVISION= 5
|
||||
PORTREVISION= 6
|
||||
CATEGORIES= java devel
|
||||
MASTER_SITES= # http://www.sun.com/software/java2/download.html
|
||||
# http://www.eyesbeyond.com/freebsddom/java/jdk14.html
|
||||
|
13
java/jdk16/files/patch-vm::os_bsd.hpp
Normal file
13
java/jdk16/files/patch-vm::os_bsd.hpp
Normal file
@ -0,0 +1,13 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- ../../hotspot/src/os/bsd/vm/os_bsd.hpp.orig Wed Oct 20 16:01:08 2004
|
||||
+++ ../../hotspot/src/os/bsd/vm/os_bsd.hpp Wed Oct 20 16:01:30 2004
|
||||
@@ -353,7 +353,7 @@
|
||||
bool trylock() {
|
||||
verify();
|
||||
int status = pthread_mutex_trylock(_mutex);
|
||||
- if (status == EBUSY)
|
||||
+ if (status == EBUSY || status == EDEADLK)
|
||||
return false;
|
||||
assert(status == 0, "pthread_mutex_trylock");
|
||||
#ifndef PRODUCT
|
Loading…
Reference in New Issue
Block a user