From 2395ce8c7fc19f937bbddbe309a2a9ea937a3b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Haoran=20S=2E=20Diao=20=28=E5=88=81=E6=B5=A9=E7=84=B6=29?= <0@hairydiode.xyz> Date: Sat, 13 Sep 2025 03:36:56 -0700 Subject: Added a delay in the im display loop so that it takes up less cpu time --- ptyim.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ptyim.c b/ptyim.c index 787581e..599eee3 100644 --- a/ptyim.c +++ b/ptyim.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -18,6 +19,11 @@ #include "im.h" #include "escape.h" #define WRITE_BUFFER_LEN 128 +//100ms latency should be fine +#define IM_LATENCY 1000000 +struct timespec im_sleep = {0, IM_LATENCY}; + + //determines if the master process is running int running = 1; //pty master and slave fd @@ -136,6 +142,7 @@ void * im_disp_routine (void *args) { out_clr = 0; } } + nanosleep(&im_sleep, NULL);; } } //main thread exit -- cgit v1.1