extensions.st
branchdevelopment
changeset 2710 78c4f4a03914
parent 2696 6b6791245acb
parent 2639 453c3d9e8a94
child 2711 a00302fe5083
--- a/extensions.st	Thu Sep 05 17:09:27 2013 +0100
+++ b/extensions.st	Thu Sep 05 22:08:59 2013 +0100
@@ -628,51 +628,20 @@
     "suspend the current process until either the relative time delta
      has passed (if millisecondDelta is non-nil), or the absolute millisecondTime
      has been reached (if resumptionTime non-nil)."
-    
-    | wasBlocked  currentDelta  dueTime  now  then |
-    isInterrupted := false.
-    millisecondDelta notNil ifTrue: [
-        now := OperatingSystem getMillisecondTime.
-        currentDelta := millisecondDelta rounded.
-        currentDelta > 16r0fffffff ifTrue: [
-            "NOTE: the microsecondTime is increasing monotonically,
-                   while millisecondTime is wrapping at 16r1fffffff.
-                   So use the microsecondTime to check when we are finished"
-            dueTime := OperatingSystem getMicrosecondTime + (currentDelta * 1000).
-            currentDelta := 16r0fffffff.
-        ].
-        then := OperatingSystem millisecondTimeAdd: now and: currentDelta.
-    ] ifFalse: [ then := resumptionTime. ].
-    wasBlocked := OperatingSystem blockInterrupts.
-    [
-        [
-            Processor signal: delaySemaphore atMilliseconds: then.
-            Processor activeProcess state: state.
-            delaySemaphore wait.
-        ] doWhile: [
-            (dueTime notNil 
-                and: [
-                    isInterrupted not 
-                        and: [ (currentDelta := dueTime - OperatingSystem getMicrosecondTime) > 0 ]
-                ]) 
-                    ifTrue: [
-                        currentDelta := (currentDelta // 1000) min: 16r0fffffff.
-                        now := OperatingSystem getMillisecondTime.
-                        then := OperatingSystem millisecondTimeAdd: now and: currentDelta.
-                        true.
-                    ]
-                    ifFalse: [ false ]
-        ].
-    ] ensure: [ wasBlocked ifFalse: [ OperatingSystem unblockInterrupts ]. ]
+
+    Processor activeProcess state:state.
+    self wait.
 
     "
      Transcript showCR:'1'.
-     (Delay forSeconds:10) wait.
-     Transcript showCR:'2'."
-
-    "Modified: / 26-02-1997 / 15:21:35 / cg"
+     (Delay forSeconds:10) waitWithState:#sleep.
+     Transcript showCR:'2'.
+    "
+
     "Modified: / 18-04-1997 / 11:56:46 / stefan"
     "Created: / 30-11-2011 / 13:38:18 / Marcel Hlopko <hlopkmar@fel.cvut.cz>"
+    "Modified: / 25-07-2013 / 11:33:41 / exept"
+    "Modified: / 25-07-2013 / 11:34:54 / cg"
 ! !
 
 !DoubleArray class methodsFor:'testing'!
@@ -1456,7 +1425,8 @@
     "if we come here, we have accquired the semaphore"
     count := count - 1.
     count == 0 ifTrue:[
-        lastOwner := Processor activeProcess.
+        activeProcess isNil ifTrue:[activeProcess := Processor activeProcess].
+        lastOwner := activeProcess.
     ].
     wasBlocked ifFalse:[OperatingSystem unblockInterrupts].
     ^ self
@@ -1687,16 +1657,13 @@
 reOpenIfPossible
     "If the socket was listening (server-sockets), try to reopen it"
 
-    | pno |
-
     listening ifFalse:[ ^ self ].
-    pno := port.
     [
-        self domain: domain type: socketType protocol: protocol reuseAddress:true.
+        self domain:domain type:socketType protocol:protocol reuseAddress:true.
         self bindTo:port address:nil.
         self listenFor: 5
     ] on: OpenError do:[
-        "Notning, socket could not be reopened"
+        "Nothing, socket could not be reopened"
     ].
 
     "Created: / 17-08-2012 / 15:43:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -1904,7 +1871,7 @@
 
 nextBytes: bytesToRead of: zmember startingAt: pos into: b startingAt: off
 
-    file position0Based: (self dataStartOf: zmember) + startOfArchive + pos.
+    file position: (self dataStartOf: zmember) + startOfArchive + pos.
     ^ file nextBytes: bytesToRead into: b startingAt: off.
 
     "Created: / 01-05-2011 / 16:21:42 / Jan Vrany <jan.vrany@fit.cvut.cz>"
@@ -1913,7 +1880,20 @@
 
 !stx_libjava class methodsFor:'documentation'!
 
+extensionsVersion_CVS
+    ^ '$Header: /cvs/stx/stx/libjava/extensions.st,v 1.8 2013-08-16 17:52:36 stefan Exp $'
+! !
+
+!stx_libjava class methodsFor:'documentation'!
+
 extensionsVersion_HG
 
     ^ '$Changeset: <not expanded> $'
 ! !
+
+!stx_libjava class methodsFor:'documentation'!
+
+extensionsVersion_SVN
+    ^ '$Id: extensions.st,v 1.8 2013-08-16 17:52:36 stefan Exp $'
+! !
+