Bug or not? Task replay after being rescheduled

Is this a bug?

// tasks, once stopped, can be resumed
t = TempoClock.new;

r = Task {
	loop {
		[thisThread.beats, thisThread.seconds].postln;
		1.0.wait;
	}
}.play(argClock: t, quant: 1);

r.stop;
t.stop;

t = TempoClock.new;

r.play(argClock: t, quant: 1);

r.stop;


// BUT a task,
// if it was transferred to a different clock
// before being stopped,
// can't be resumed anymore

t = TempoClock.new;

(
r = Task({
	loop {
		[thisThread.beats, thisThread.seconds].postln;
		1.0.wait;
	}
}).play(argClock: t, quant: 1);
)

// reschedule
(
u = TempoClock(t.tempo, t.beats.frac);
u.schedAbs(r.nextBeat + u.beats - t.beats, r);
t.stop;
)

// same sequence as initially --
// stop the task, then stop the clock
r.stop;
u.stop;

// now try to resume the task
// TempoClock.default hasn't been stopped
// it is definitely running!
// but nothing is posted
r.play(argClock: TempoClock.default);

// also try -- no difference
r.play(argClock: TempoClock.default, doReset: true);

Apparently the “reschedule” block does something funky to the Task’s state. But, as far as I can see, the last line (play with reset) should restore everything to a functioning state… but it doesn’t.

I’m out of time, and this isn’t critical for my own use cases, so I’m going to leave it here… anyone else able to figure it out?

hjh

I tested your sample code and it works, it resumes posting.

Thanks –

As it happens, yesterday I had updated my development branch (for a different reason), and the problem is no longer reproducible.

I also tried switching back to the branch that I had been using before updating, and – still not reproducible.

So… I have no idea what was happening yesterday, but it definitely wasn’t working.

Oh well…
hjh