This is the mail archive of the
cygwin@cygwin.com
mailing list for the Cygwin project.
Thread.start called but threads not available
- From: Jacques Grelet <Jacques dot Grelet at ird dot fr>
- To: cygwin at cygwin dot com
- Date: Mon, 18 Nov 2002 17:04:45 +0100
- Subject: Thread.start called but threads not available
Hi,
I have compiled a java source with gcj under cygwin on win2000:
gcj -o serveur --main=serveur serveur.java
The programme gave the following message about threads not available, but
gcc seems to be compiled with threads enable.
Why ?
Thanks for help,
[jgrelet]:/s/outils/sources/serveur> ./serveur 10183
Serveur version java 1.1 port UDP : 10183
Exception in thread "main" java.lang.InternalError: Thread.start called but
threads not available
[jgrelet]:/s/outils/sources/serveur> gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.2/specs
Configured with: /netrel/src/gcc-3.2-3/configure
--enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix
--with-system-zlib --enable-nls --without-included-gettext
--enable-interpreter --disable-sjlj-exceptions
--disable-version-specific-runtime-libs --enable-shared
--build=i686-pc-linux --host=i686-pc-cygwin --target=i686-pc-cygwin
--enable-haifa --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc
--libdir=/usr/lib --includedir=/nonexistent/include --libexecdir=/usr/sbin
Thread model: posix
gcc version 3.2 20020927 (prerelease)
Source code is :
/* serveur.java J Grelet juillet 98
Test de reception de trames ethernet
*/
import java.awt.*;
import java.io.*;
import java.net.*;
import java.lang.*;
import java.applet.*;
import java.util.Date;
/****************************************************************************
****************************************************************************/
public class serveur {
static int PortNumber;
public static void main( String argv[] ) {
try {
PortNumber = Integer.valueOf( argv[ 0 ] ).intValue();
}
catch( ArrayIndexOutOfBoundsException e ) {
System.out.println( "\nusage : java serveur <port UDP>\n" );
System.exit( 0 );
}
System.out.println( "\nServeur version java 1.1 port UDP : " +
PortNumber + "\n\n" );
try {
DatagramSocket sd = new DatagramSocket( PortNumber );
receive rcv = new receive( sd );
rcv.start();
}
catch( SocketException se ) {
System.err.println( se );
}
}
}
/****************************************************************************
****************************************************************************/
class receive extends Thread {
DatagramSocket sd;
protected DatagramPacket pd;
static byte[] buffer = new byte[ 1024 ];
public receive( DatagramSocket s ){
sd = s;
}
/****************************************************************************
****************************************************************************/
public void run() {
while( true ) {
try {
pd = new DatagramPacket( buffer, buffer.length );
sd.receive( pd );
String s = new String( pd.getData(),0,pd.getLength()-2, "8859_1" );
System.out.println( s );
Thread.yield(); // le thread cede sa place au suivant
}
catch( IOException e ){
System.err.println( e );
}
} // fin de la boucle while
}
}
Jacques Grelet
Email: Jacques.Grelet@ird.fr
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Bug reporting: http://cygwin.com/bugs.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/