PauseStream cannot pause itself

(
t = Task {
	"go".postln;
	1.0.wait;
	"pausing".postln;
	t.pause;
	
	"should resume here".postln;
}.play;
)

t.resume;  // nothing

This is a nasty problem for a current use case (a breakpoint in the middle of recorded audio playback). The thread really should pause itself, not stop itself forever.

There is class library: implement correct stop behaviour for Task · supercollider/supercollider@7b4b1f0 · GitHub which makes Task’s behavior here match Routine’s.

In hindsight… was that necessary? What was going wrong that necessitated this?

Task is meant to be pausable while Routine isn’t, so, was it correct to make them behave the same in this case?

I guess I’ll have to work around it with a global CondVar…? Any other ideas?

hjh

on second thought, I think CondVar is the right approach (as an externally-resumable breakpoint) – so, consider it a documentation issue – if CondVar wasn’t my first thought for this case, there are probably others who won’t think of it soon enough.

hjh