- call Thread.exit() even if thread is aborted by user (or Smalltalk code) jk_new_structure
authorvranyj1
Mon, 14 Nov 2011 22:27:42 +0000
branchjk_new_structure
changeset 1110 7413fa7769ec
parent 1109 9bd0544f9046
child 1111 7feb6c5ffbc4
- call Thread.exit() even if thread is aborted by user (or Smalltalk code) - fixes in java.net.* natives - gnu.testlet.java.net.Socket test pass.
src/JavaProcess.st
src/JavaVM.st
src/Make.proto
src/Make.spec
src/bc.mak
src/libjava.rc
--- a/src/JavaProcess.st	Mon Nov 14 20:16:09 2011 +0000
+++ b/src/JavaProcess.st	Mon Nov 14 22:27:42 2011 +0000
@@ -242,13 +242,16 @@
                             ]
                             do:[
                                 "/ Transcript showCR:(Timestamp now printString , 'start thread: ', stProcess name).
-                                javaThreadObject perform:#'run()V'.
-                                (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
-                                    Logger log: ('thread ' , javaProcess name , ' terminated') severity: #info facility: 'JVM'.
-                                ].
-                                javaThreadObject perform:#'exit()V'.
-                                (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
-                                    Logger log: ('after exit of thread ' , javaProcess name) severity: #info facility: 'JVM'.
+                                [
+                                    javaThreadObject perform:#'run()V'.
+                                    (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
+                                        Logger log: ('thread ' , javaProcess name , ' terminated') severity: #info facility: 'JVM'.
+                                    ].
+                                ] ensure:[
+                                    javaThreadObject perform:#'exit()V'.
+                                    (Smalltalk at:#'JavaVM:ThreadTrace') == true ifTrue:[
+                                        Logger log: ('after exit of thread ' , javaProcess name) severity: #info facility: 'JVM'.
+                                    ]
                                 ]
                             ]
                     ]
--- a/src/JavaVM.st	Mon Nov 14 20:16:09 2011 +0000
+++ b/src/JavaVM.st	Mon Nov 14 22:27:42 2011 +0000
@@ -7312,6 +7312,27 @@
     "Modified: / 09-11-2011 / 22:26:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+_java_net_PlainSocketImpl_socketAvailable: nativeContext
+
+    <javanative: 'java/net/PlainSocketImpl' name: 'socketAvailable()I'>
+
+        |jSock sock n|
+
+    jSock := nativeContext receiver.
+
+    sock := self validateFile:jSock.
+    sock isNil ifTrue:[
+	self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
+	^ self.
+    ].
+
+    n := sock numAvailable.
+    ^ n
+
+    "Created: / 4.2.1998 / 16:58:49 / cg"
+    "Modified: / 30.12.1998 / 20:10:08 / cg"
+!
+
 _java_net_PlainSocketImpl_socketBind: nativeContext
 
     <javanative: 'java/net/PlainSocketImpl' name: 'socketBind(Ljava/net/InetAddress;I)V'>
@@ -7689,14 +7710,14 @@
     ].
 
     [
-        nread := sock readInto: data startingAt: off count: len.
+        nread := sock readInto: data startingAt: off + 1 count: len.
     ] on: Error do:[:ex|
         self throwSocketException: 'Error when reading: ', ex description.
     ].
 
     ^nread
 
-    "Modified: / 13-11-2011 / 23:49:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-11-2011 / 23:26:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 _java_net_SocketOutputStream_init: nativeContext
@@ -7727,12 +7748,12 @@
     sock := self validateFile: fdObj.
 
     [
-        sock nextPutBytes: len from: data startingAt: off.
+        sock nextPutBytes: len from: data startingAt: off + 1.
     ] on: Error do:[:ex|
         self throwIOExceptionWithMessage: 'Error when writing: ', ex description.
     ].
 
-    "Modified: / 13-11-2011 / 23:53:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 14-11-2011 / 23:08:31 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !JavaVM class methodsFor:'native - java.security'!
@@ -11257,24 +11278,6 @@
     "Modified: / 30.12.1998 / 20:10:16 / cg"
 !
 
-_PlainSocketImpl_socketAvailable:nativeContext
-    |jSock sock n|
-
-    jSock := nativeContext receiver.
-
-    sock := self validateFile:jSock.
-    sock isNil ifTrue:[
-	self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
-	^ self.
-    ].
-
-    n := sock numAvailable.
-    ^ n
-
-    "Created: / 4.2.1998 / 16:58:49 / cg"
-    "Modified: / 30.12.1998 / 20:10:08 / cg"
-!
-
 _PlainSocketImpl_socketClose:nativeContext
     |jsock sock|
 
@@ -15105,6 +15108,26 @@
     ^ self _WGraphics_pSetForeground:nativeContext
 ! !
 
+!JavaVM class methodsFor:'native - old-style (converted)'!
+
+_PlainSocketImpl_socketAvailable:nativeContext
+    |jSock sock n|
+
+    jSock := nativeContext receiver.
+
+    sock := self validateFile:jSock.
+    sock isNil ifTrue:[
+	self throwIOExceptionWithMessage:'socketAvailable on closed socket'.
+	^ self.
+    ].
+
+    n := sock numAvailable.
+    ^ n
+
+    "Created: / 4.2.1998 / 16:58:49 / cg"
+    "Modified: / 30.12.1998 / 20:10:08 / cg"
+! !
+
 !JavaVM class methodsFor:'native - stx.libjava.tests'!
 
 _stx_libjava_tests_MonitorTests_abort: nativeContext
--- a/src/Make.proto	Mon Nov 14 20:16:09 2011 +0000
+++ b/src/Make.proto	Mon Nov 14 22:27:42 2011 +0000
@@ -1,7 +1,7 @@
 # $Header$
 #
 # DO NOT EDIT
-# automagically generated from the projectDefinition: stx_libjava at 2011-11-14 00:00:23.638.
+# automagically generated from the projectDefinition: stx_libjava at 2011-11-14 23:28:39.829.
 #
 # Warning: once you modify this file, do not rerun
 # stmkmp or projectDefinition-build again - otherwise, your changes are lost.
--- a/src/Make.spec	Mon Nov 14 20:16:09 2011 +0000
+++ b/src/Make.spec	Mon Nov 14 22:27:42 2011 +0000
@@ -1,7 +1,7 @@
 # $Header$
 #
 # DO NOT EDIT
-# automagically generated from the projectDefinition: stx_libjava at 2011-11-14 00:00:22.571.
+# automagically generated from the projectDefinition: stx_libjava at 2011-11-14 23:28:37.911.
 #
 # Warning: once you modify this file, do not rerun
 # stmkmp or projectDefinition-build again - otherwise, your changes are lost.
--- a/src/bc.mak	Mon Nov 14 20:16:09 2011 +0000
+++ b/src/bc.mak	Mon Nov 14 22:27:42 2011 +0000
@@ -1,7 +1,7 @@
 # $Header$
 #
 # DO NOT EDIT
-# automagically generated from the projectDefinition: stx_libjava at 2011-11-14 00:00:24.088.
+# automagically generated from the projectDefinition: stx_libjava at 2011-11-14 23:28:40.655.
 #
 # Warning: once you modify this file, do not rerun
 # stmkmp or projectDefinition-build again - otherwise, your changes are lost.
--- a/src/libjava.rc	Mon Nov 14 20:16:09 2011 +0000
+++ b/src/libjava.rc	Mon Nov 14 22:27:42 2011 +0000
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "Copyright Claus Gittinger 1988-2011\nCopyright eXept Software AG 1998-2011\nCopyright Jan Vrany, Jan Kurs and Marcel Hlopko\b          SWING Research Group, Czech Technical University In Prague\0"
       VALUE "ProductName", "Smalltalk/X\0"
       VALUE "ProductVersion", "6.2.1.1\0"
-      VALUE "ProductDate", "Sun, 13 Nov 2011 23:00:42 GMT\0"
+      VALUE "ProductDate", "Mon, 14 Nov 2011 22:29:09 GMT\0"
     END
 
   END