In TKTService, I'd like to have the possibility to trigger one iteration before the delay expires. I tried the following implementation and would like to know your opinion (I'm not strong in concurrency :-/):
TKTService>>
iterateService
self stepService.
stepDelay wait
as:
TKTService>>
iterateService
self stepService.
iterationSemaphore wait: stepDelay
(where stepDelay is a Duration) and added this method:
TKTService>>
anticipateIteration
iterationSemaphore signal
Which seems to work. Before, I tried an alternative: don't touch TKTService at all but anticipate the Delay with:
Delay>>
anticipate
"Produce the same effect as if the delay (currently in progress) finished now."
self unschedule.
self delaySemaphore signal
but this looked more fragile... touching private behavior of a Kernel class.
In TKTService, I'd like to have the possibility to trigger one iteration before the delay expires. I tried the following implementation and would like to know your opinion (I'm not strong in concurrency :-/):
as:
(where stepDelay is a Duration) and added this method:
Which seems to work. Before, I tried an alternative: don't touch TKTService at all but anticipate the Delay with:
but this looked more fragile... touching private behavior of a Kernel class.