Please rewrite it :)
Stef
On Apr 14, 2013, at 9:52 PM, Igor Stasenko <siguctua@gmail.com> wrote:
> the more i learn about DateAndTime the more i lean towards completely
> rewriting this ... err..
> crap. (yes. sorry for harsh word).
>
> DateAndTime class>>now
> is not thread-safe..
>
> now
> � � � | nanoTicks msm |
>
> � � � nanoTicks := (msm := self milliSecondsSinceMidnight) * 1000000.
>
> � � � (LastTick < nanoTicks) ifTrue: [
> � � � � � � � LastTick := nanoTicks.
> � � � � � � � ^ self todayAtMilliSeconds: msm].
>
> � � � LastTickSemaphore critical: [
> � � � � � � � LastTick := �LastTick + 1.
> � � � � � � � ^ self todayAtNanoSeconds: LastTick]
>
> Wrapping only single assignment to variable with critical section
> while leaving another without it
> is same as if not using critical section at all.
>
>
> --
> Best regards,
> Igor Stasenko.
>