delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/11/18/11:05:28

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-Id: <5.0.2.1.2.20021118165822.01975f08@brest.ifremer.fr>
X-Sender: jgrelet AT brest DOT ifremer DOT fr
Date: Mon, 18 Nov 2002 17:04:45 +0100
To: cygwin AT cygwin DOT com
From: Jacques Grelet <Jacques DOT Grelet AT ird DOT fr>
Subject: Thread.start called but threads not available
Mime-Version: 1.0

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 DOT Grelet AT ird DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019