Socket>>#waitForDataFor:ifClosed:ifTimedOut: large delay hangs process

squeakdev1 at reider.net squeakdev1 at reider.net
Tue Jan 15 18:54:29 UTC 2008


The trick is to come up with a robust implementation of
absoluteMillisecondClockValue. My previous idea, (Time
millisecondsSince:0) was wrong; it is equivalent to just (Time
millisecondClockValue). Maybe something like:

absoluteMillisecondClockValue

	| last next wrap |
        wrap := SmallInteger maxVal.  "is this correct?"
	last  := LastAbsoluteMillisecondClockValue ifNil:[0]. "class var"
	next := Time millisecondClockValue .
	[next  < last ] whileTrue:[ next := next + wrap].
        "or:
        next < last ifTrue:[ next := last + (wrap - (last \\ wrap)) + next]."
	^LastAbsoluteMillisecondClockValue := next

> Maybe that's what should have been done in the first place, at least
> in part because it's so hard to debug such rarely-used code.
>
> Cheers!
>
> --Tom Phoenix
>



More information about the Squeak-dev mailing list