Skip to content

TKTService: provide a method to move the next iteration ahead? #74

Description

@tinchodias

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions