[Newbies] Re: Update Timer?

2015-05-02 Thread Kirk Fraser
Sleeping on a problem helped in this case.

Time current minutes  timer minutes + 10
ifTrue: [^#waiting].
timer := Time current.

I put that in an update method called by methods that change the data.  Not
guaranteed every 10 min depending on user behavior but close enough and
easier than defining a process.


On Fri, May 1, 2015 at 10:14 PM, Kirk Fraser overcomer@gmail.com
wrote:

 I am building a simple database using a tree and a ReferenceStream as
 learned here.  I want it to update the disk file every 10 min. with the
 current tree.  What should I do?

 The classes Time, Duration, Stopwatch, Schedule, look like possibilities
 but the only method that looks good is Schedule between: aStart and: anEnd
 do: aBlock but I don't want it to hang waiting on the timer so the tree
 can't take my changes.  How do I make something perform like a text editor
 that saves its work every 10 min?

 Thanks,

 Kirk Fraser

___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners


[Newbies] Re: Update Timer?

2015-05-02 Thread Kirk Fraser
Woops!  What if timer + 10 gets bigger than 60?

Time current - timer  10

When you can't get help, help yourself!

On Sat, May 2, 2015 at 10:21 PM, Kirk Fraser overcomer@gmail.com
wrote:

 Sleeping on a problem helped in this case.

 Time current minutes  timer minutes + 10
 ifTrue: [^#waiting].
 timer := Time current.

 I put that in an update method called by methods that change the data.
 Not guaranteed every 10 min depending on user behavior but close enough and
 easier than defining a process.


 On Fri, May 1, 2015 at 10:14 PM, Kirk Fraser overcomer@gmail.com
 wrote:

 I am building a simple database using a tree and a ReferenceStream as
 learned here.  I want it to update the disk file every 10 min. with the
 current tree.  What should I do?

 The classes Time, Duration, Stopwatch, Schedule, look like possibilities
 but the only method that looks good is Schedule between: aStart and: anEnd
 do: aBlock but I don't want it to hang waiting on the timer so the tree
 can't take my changes.  How do I make something perform like a text editor
 that saves its work every 10 min?

 Thanks,

 Kirk Fraser



___
Beginners mailing list
Beginners@lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/beginners