mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-26 08:49:37 +00:00
Avoid the whole thread hop for a zero-length run_for.
This commit is contained in:
parent
10108303e7
commit
75f3f1a77f
@ -368,6 +368,10 @@ template <typename SampleSource> class PullLowpass: public LowpassBase<PullLowpa
|
|||||||
at construction, filtering it and passing it on to the speaker's delegate if there is one.
|
at construction, filtering it and passing it on to the speaker's delegate if there is one.
|
||||||
*/
|
*/
|
||||||
void run_for(Concurrency::DeferringAsyncTaskQueue &queue, const Cycles cycles) {
|
void run_for(Concurrency::DeferringAsyncTaskQueue &queue, const Cycles cycles) {
|
||||||
|
if(cycles == Cycles(0)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
queue.defer([this, cycles] {
|
queue.defer([this, cycles] {
|
||||||
run_for(cycles);
|
run_for(cycles);
|
||||||
});
|
});
|
||||||
@ -383,10 +387,7 @@ template <typename SampleSource> class PullLowpass: public LowpassBase<PullLowpa
|
|||||||
at construction, filtering it and passing it on to the speaker's delegate if there is one.
|
at construction, filtering it and passing it on to the speaker's delegate if there is one.
|
||||||
*/
|
*/
|
||||||
void run_for(const Cycles cycles) {
|
void run_for(const Cycles cycles) {
|
||||||
std::size_t cycles_remaining = size_t(cycles.as_integral());
|
process(size_t(cycles.as_integral()));
|
||||||
if(!cycles_remaining) return;
|
|
||||||
|
|
||||||
process(cycles_remaining);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SampleSource &sample_source_;
|
SampleSource &sample_source_;
|
||||||
|
Loading…
Reference in New Issue
Block a user