I found that initializeOffsets method setUp many class vars of DateAndTime. And it is ot thread safe. For example, DateAndTime>>now method can change some class vars when it's not initialized properly yet. <br>And there is no guarantee that another registered startUp method does not corrupt some DateAndTime class state.<br>
Maybe cuis version takes into account this posible issues. Now I just removed fork in DateAndTime>>startUp method and send fixed application for testing.<br><br>Another question: <br>Why DateAndTime so complex? Why DateAndTime>>now does not return OS api value from some simple primitive?<br>
<br><div class="gmail_quote">2011/1/27 Levente Uzonyi <span dir="ltr"><<a href="mailto:leves@elte.hu">leves@elte.hu</a>></span><br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div><div></div><div class="h5">On Thu, 27 Jan 2011, Denis Kudriashov wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Why initializeOffsets executes by fork in startUp method?<br>
<br>
startUp: resuming<br>
resuming ifFalse: [ ^ self ].<br>
[ self initializeOffsets.] fork<br>
<br>
<br>
Cuise has this version:<br>
<br>
startUp: resuming<br>
resuming ifFalse: [ ^ self ].<br>
OffsetsAreValid _ false.<br>
[<br>
self initializeOffsets.<br>
OffsetsAreValid _ true<br>
] forkAt: Processor userInterruptPriority.<br>
<br>
<br>
Why not just<br>
<br>
startUp: resuming<br>
resuming ifFalse: [ ^ self ].<br>
self initializeOffsets.<br>
<br>
?<br>
<br>
I have appilcation. And sometimes when I run squeak I have bad dateTime<br>
equal to last saved value.<br>
<br>
I cant reproduced it manually.<br>
Can it be due wrong squeak implementation?<br>
<br>
</blockquote>
<br></div></div>
You didn't state it explicitly, but I found out that you're using Squeak 4.1. In Squeak 4.2 we have the Cuis version of this method. But your issue is unrelated. The change from Cuis makes the startup process faster by forking #initializeOffsets. #initializeOffsets causes an at most 1 second pause which is avoided by this "trick".<br>
<font color="#888888">
<br>
<br>
Levente<br>
<br>
</font></blockquote></div><br>