Package: librxtx-java
Version: 2.2pre2-10
Severity: normal
Tags: patch

Dear Maintainer,

Threads created in Java by RXTX are not marked as daemon. They hold
the JVM open so that it can't shut down gracefully, as it normally
does when all non-daemon threads have completed. So Java applications
using RXTX can only exit by a System.exit(0).

The threads are an implementation detail, invisible to users of the
library, so users shouldn't be relying on these threads being
non-dameon.

The attached patch makes all RXTX threads daemon threads. I've been
using this patch successfully for 6 months now. I intended to submit
this to upstream, but it seems to be dead right now.


-- System Information:
Debian Release: wheezy/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 3.2.0-2-686-pae (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages librxtx-java depends on:
ii  libc6  2.13-32

librxtx-java recommends no packages.

librxtx-java suggests no packages.

-- no debconf information
--- a/src/gnu/io/I2C.java
+++ b/src/gnu/io/I2C.java
@@ -468,7 +468,9 @@
 		private boolean BI=false;
 		private boolean Data=false;
 		private boolean Output=false;
-		MonitorThread() { }
+		MonitorThread() {
+			setDaemon(true);
+		}
 		public void run() {
 			eventLoop();
 		}
--- a/src/gnu/io/LPRPort.java
+++ b/src/gnu/io/LPRPort.java
@@ -366,7 +366,9 @@
 {
 	private boolean monError = false;
 	private boolean monBuffer = false;
-		MonitorThread() { }
+		MonitorThread() {
+			setDaemon(true);
+		}
 		public void run()
 		{
 			eventLoop();
--- a/src/gnu/io/RS485.java
+++ b/src/gnu/io/RS485.java
@@ -465,7 +465,9 @@
 		private boolean BI=false;
 		private boolean Data=false;
 		private boolean Output=false;
-		MonitorThread() { }
+		MonitorThread() {
+			setDaemon(true);
+		}
 		public void run() {
 			eventLoop();
 		}
--- a/src/gnu/io/RXTXPort.java
+++ b/src/gnu/io/RXTXPort.java
@@ -1629,6 +1629,7 @@
 
 		MonitorThread() 
 		{
+			setDaemon(true);
 			if (debug)
 				z.reportln( "RXTXPort:MontitorThread:MonitorThread()"); 
 		}
--- a/src/gnu/io/Raw.java
+++ b/src/gnu/io/Raw.java
@@ -466,7 +466,9 @@
 		private boolean BI=false;
 		private boolean Data=false;
 		private boolean Output=false;
-		MonitorThread() { }
+		MonitorThread() {
+			setDaemon(true);
+		}
 		public void run() {
 			eventLoop();
 		}
__
This is the maintainer address of Debian's Java team
<http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-maintainers>. 
Please use
debian-j...@lists.debian.org for discussions and questions.

Reply via email to