Skip to content

Commit

Permalink
Fix while loop that was consuming a whole CPU
Browse files Browse the repository at this point in the history
  • Loading branch information
wheaney committed Dec 21, 2023
1 parent a56e2fd commit 3371ce4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/xreal.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,9 @@ void xreal_block_on_device() {
pthread_t controller_thread;
pthread_create(&controller_thread, NULL, poll_controller_func, NULL);

while (!driver_device_should_disconnect() && glasses_controller && glasses_imu);
while (!driver_device_should_disconnect() && glasses_controller && glasses_imu) {
sleep(1);
}

pthread_join(imu_thread, NULL);
pthread_join(controller_thread, NULL);
Expand Down

0 comments on commit 3371ce4

Please sign in to comment.