[prev in list] [next in list] [prev in thread] [next in thread]
List: rxtx
Subject: [Rxtx] Re: More close() performance fixes
From: Øyvind Harboe <oyvind.harboe () zylin ! com>
Date: 2006-01-19 9:59:11
Message-ID: 1137664751.4286.52.camel () localhost ! localdomain
[Download RAW message or body]
How about this one?
AFAICT, there was a superfluous synchronization mechanism
for waiting for the notification thread to complete which caused
the 100ms delay.
--
Øyvind Harboe
http://www.zylin.com
["fasterclose2.txt" (fasterclose2.txt)]
Index: ChangeLog
===================================================================
RCS file: /usr/local/cvsroot/rxtx-devel/ChangeLog,v
retrieving revision 1.24.2.52
diff -u -r1.24.2.52 ChangeLog
--- ChangeLog 16 Jan 2006 03:09:01 -0000 1.24.2.52
+++ ChangeLog 19 Jan 2006 09:50:35 -0000
@@ -5,6 +5,9 @@
you downloaded.
2.1-8 Jan ?? 2006
+ Øyvind Harboe <oyvind.harboe@zylin.com>
+ improved close() performance using only Thread.join() to wait for monitor
+ thread to complete. Ca. 100ms to 1-10ms on a Linux Debian box.
Blue Tooth Support
cleanup writeByte so close works, send the original exceptions
so people can see the exception.
Index: src/RXTXPort.java
===================================================================
RCS file: /usr/local/cvsroot/rxtx-devel/src/RXTXPort.java,v
retrieving revision 1.27.2.68
diff -u -r1.27.2.68 RXTXPort.java
--- src/RXTXPort.java 16 Jan 2006 03:55:24 -0000 1.27.2.68
+++ src/RXTXPort.java 19 Jan 2006 09:50:35 -0000
@@ -40,7 +40,7 @@
protected final static boolean debug_write = false;
protected final static boolean debug_events = false;
protected final static boolean debug_verbose = false;
-
+
private static Zystem z;
static
@@ -752,7 +752,6 @@
*/
boolean MonitorThreadLock = true;
- boolean MonitorThreadCloseLock = true;
public void addEventListener(
SerialPortEventListener lsnr ) throws TooManyListenersException
@@ -805,25 +804,14 @@
They will call back to see if its their thread
using isInterrupted().
*/
- MonitorThreadCloseLock = true;
if (debug)
z.reportln( " RXTXPort:calling interruptEventLoop");
interruptEventLoop( );
- if (debug)
- z.reportln(" RXTXPort:waiting on closelock");
- while( MonitorThreadCloseLock )
- {
- if (debug)
- z.reportln(" .");
- try {
- Thread.sleep(100);
- } catch( Exception e ) {}
- }
- if (debug)
- z.reportln(" RXTXPort:set closelock");
+
if (debug)
z.reportln( " RXTXPort:calling monThread.join()");
- try {
+ try
+ {
monThread.join(1000);
} catch (Exception ex) {
/* yikes */
@@ -1584,7 +1572,6 @@
z.reportln( "RXTXPort:MontitorThread:run()");
monThreadisInterrupted=false;
eventLoop();
- MonitorThreadCloseLock = false;
if (debug)
z.reportln( "eventLoop() returned");
}
_______________________________________________
Rxtx mailing list
Rxtx@qbang.org
http://mailman.qbang.org/mailman/listinfo/rxtx
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic