From ced5898a3146bf53e7ccfe377d431ea59e368e1d Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Wed, 20 Feb 2013 09:34:21 +0100 Subject: [PATCH] pharo: The TimerDispatcher needs more work on Pharo for image resume In Pharo the Delay>>wait for one second will not expire anytime soon in a new image. Use the depedency handling so we can terminate and restart the loop. --- Makefile | 3 ++- Timer.st | 13 +++++++++++++ changes_for_pharo.st | 19 +++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 changes_for_pharo.st diff --git a/Makefile b/Makefile index c851331..6d69148 100644 --- a/Makefile +++ b/Makefile @@ -14,4 +14,5 @@ all: convert: $(GST_CONVERT) $(CONVERT_RULES) -F squeak -f gst \ - -o fileout.st compat_for_pharo.st LogArea.st Dispatcher.st Timer.st Tests.st + -o fileout.st compat_for_pharo.st LogArea.st Dispatcher.st Timer.st Tests.st \ + changes_for_pharo.st diff --git a/Timer.st b/Timer.st index 4717abb..9281f9b 100644 --- a/Timer.st +++ b/Timer.st @@ -94,11 +94,24 @@ bit difficult to do this race free.'> quit := true. ] + platformInit [ + + "Nothing for GST..." + ] + initialize [ queue := SortedCollection sortBlock: [:a :b | a timeout < b timeout]. sem := Semaphore forMutualExclusion. quit := false. + self + startLoop; + platformInit. + ] + + startLoop [ + + loop := [Processor activeProcess name: 'Osmo Timers'. self runTimers] fork. ] diff --git a/changes_for_pharo.st b/changes_for_pharo.st new file mode 100644 index 0000000..fce84bb --- /dev/null +++ b/changes_for_pharo.st @@ -0,0 +1,19 @@ +TimerScheduler extend [ + TimerScheduler class >> startUp [ + Smalltalk at: #OsmoTimeScheduler ifPresent: [ + OsmoTimeScheduler reinitialize. + ]. + ] + + platformInit [ + + "Pharo requires us to do some post-processing" + Smalltalk addToStartUpList: self class. + ] + + reinitialize [ + + loop terminate. + self startLoop. + ] +]