Skip to content

Commit c348e15

Browse files
p3r7robbielyman
andauthored
fix: reduce high CPU usage in clock threads (#120)
* fix high CPU usage due to ableton link loop * fix: sleep for 100 microseconds, not just one --------- Co-authored-by: Rylee Lyman <rylee.alanza@gmail.com>
1 parent 790da23 commit c348e15

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/clock.zig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ const Fabric = struct {
125125
self.lock.lock();
126126
self.do_tick();
127127
self.lock.unlock();
128-
std.time.sleep(1000);
128+
std.time.sleep(std.time.ns_per_us * 100);
129129
}
130130
}
131131
fn do_tick(self: *Fabric) void {
@@ -209,7 +209,7 @@ const Link_Beat_Reference = struct {
209209
}
210210
if (last > beat) reschedule_sync_events();
211211
c.abl_link_commit_audio_session_state(fabric.link, fabric.state);
212-
std.time.sleep(1000);
212+
std.time.sleep(std.time.ns_per_us * 100);
213213
}
214214
}
215215
};

0 commit comments

Comments
 (0)