From owner-freebsd-java Thu Aug 24 3:10:52 2000 Delivered-To: freebsd-java@freebsd.org Received: from osku.suutari.iki.fi (osku.syncrontech.com [213.28.98.4]) by hub.freebsd.org (Postfix) with ESMTP id 71F9C37B423 for ; Thu, 24 Aug 2000 03:10:49 -0700 (PDT) Received: from coffee (adsl-nat.syncrontech.com [213.28.98.3]) by osku.suutari.iki.fi (8.9.3/8.9.3) with SMTP id NAA32292; Thu, 24 Aug 2000 13:10:46 +0300 (EEST) (envelope-from ari@suutari.iki.fi) Message-ID: <00da01c00db3$9261bd80$0e05a8c0@intranet.syncrontech.com> From: "Ari Suutari" To: "Gary Howland" Cc: , References: <00ce01c00d9a$bce31fe0$0e05a8c0@intranet.syncrontech.com> Subject: Solved: JDK 2 Patchset 10 + FreeBSD_CommAPI Date: Thu, 24 Aug 2000 13:10:46 +0300 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Sender: owner-freebsd-java@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org Hi again (I feel like talking to myself already....) Just got things working with patchset 10. The problem is that FreeBSD_CommAPI uses select(2), which is no longer overrided by green threads package. The select support of green threads is behind #ifdef USE_SELECT (see src/freebsd/hpi/green_threads/src/iomgr.c), which seems to defined by Makefiles only if FreeBSD version is old enough (there seems to be a condition for it in Defs-freebsd.gmk). So I came up with two different solutions: 1) Modify CommAPI so that it uses poll instead of select. I have done this and tested it and it seems to work OK. 2) Modify JDK for next patchset so that a wrapper for select is provided by green threads. Maybe this would be a good thing, since there may be other JNI code out in the world which relies on select and omission for wrapper causes such code to fail. Ari S. > > > > > It was nothing to do with threads, more to do with using the wrong flags > > with termio > > > > The termio stuff seems to need some polising. There seems to > be a fcntl call to setup SIGIO delivery, but the signal is not handled > anywhere. Also, what might be the idea behind VMIN & VTIME > settings, I'm not sure that the current selection is the best one. > > However, what is causing my problem is really that other threads > are not running when JNI code sits in a loop periodically calling > select(2). Partial fix seems to be to call Thread.yield inside > that loop, but even with that, the threads are scheduled in a manner > that is far away from perfect. > > When I look at JDK sources how, for example, a read from socket > is implemented, it seems to be so that it calls JVM_Read which > in turn calls sysRead, which in turn calls a wrapper provided by > green threads package. > > So, shouldn't the JNI stuff in comm package > (libSerial.so) be linked against green threads wrappers somehow > to make things really work ? > > Ari S. > To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-java" in the body of the message