Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppClock schedAbs #5851

Merged
merged 7 commits into from
Sep 9, 2022
Merged

Conversation

telephon
Copy link
Member

@telephon telephon commented Aug 24, 2022

Purpose and Motivation

Fixes #5700.

Types of changes

  • Documentation
  • Bug fix
  • New feature

To-do list

  • Code is tested
  • All tests are passing
  • Updated documentation
  • This PR is ready for review

Copy link
Contributor

@jamshark70 jamshark70 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the LinkClock issue, would you mind adding documentation for schedAbs? New methods should be documented unless they are private.

testsuite/classlibrary/TestTask.sc Outdated Show resolved Hide resolved
@telephon
Copy link
Member Author

In addition to the LinkClock issue, would you mind adding documentation for schedAbs? New methods should be documented unless they are private.

I just had a quick coffee. :)

@telephon telephon changed the title Topic app clock sched abs Topic app clock schedAbs Aug 24, 2022
@telephon telephon changed the title Topic app clock schedAbs AppClock schedAbs Aug 24, 2022
@jamshark70
Copy link
Contributor

I just had a quick coffee. :)

Ha ha! OK... what happened was, I was just sitting down to add schedAbs myself, and then saw an e-mail that you had done it, and went to review it quickly.

I think that a prior SC maintainer would have preferred CondVar over 0.002.wait (out of a general preference for avoiding hardcoded wait times). For that matter, even the 0.001.wait within the Tasks are unnecessary; for the test, we only require the Task to awaken once, not twice. I guess I personally won't be that much of a stickler, but I do see their prior point that habitually consuming extra milliseconds in testing could cumulatively slow down the test suite more than you'd think.

So perhaps:

	test_play_with_AppClock {
		var ok = false;
		var cond = CondVar.new;
		var task = Task { ok = true; cond.signalAll };
		task.play(AppClock);
		cond.waitFor(0.1, { ok });
		task.stop;
		this.assert(ok, "Task plays with AppClock");
	}

@telephon
Copy link
Member Author

Yes, I did see your suggestion further up. I had decided for simplicity – while I do understand conditions, I have to admit that I have to read three times the code needed to use them …

@dyfer dyfer added the comp: class library SC class library label Aug 24, 2022
@dyfer dyfer added this to the 3.13.0 milestone Aug 24, 2022
@telephon
Copy link
Member Author

OK, so here is a test series that factors out the "complicated" bits.

@telephon
Copy link
Member Author

@jamshark70 if you have the time, could you review it and if ok mark your change request as fulfilled?

}

test_play_with_TempoClock {
this.makePlayTestWithClock(TempoClock.default, "TempoClock.default");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd have to suggest TempoClock.new here, because it will be stop-ped later. (As a rule of thumb, if this block of code didn't create the clock, then it shouldn't be stopping the clock.)

@dyfer
Copy link
Member

dyfer commented Sep 7, 2022

@jamshark70 do you have any more requests for this PR?

@jamshark70
Copy link
Contributor

LGTM 👍

@dyfer dyfer merged commit 0f6ba8f into supercollider:develop Sep 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp: class library SC class library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Task-play fails when using AppClock
3 participants