diff options
author | Haoran S. Diao (刁浩然) <0@hairydiode.xyz> | 2025-09-13 03:36:56 -0700 |
---|---|---|
committer | Haoran S. Diao (刁浩然) <0@hairydiode.xyz> | 2025-09-13 03:36:56 -0700 |
commit | 2395ce8c7fc19f937bbddbe309a2a9ea937a3b86 (patch) | |
tree | f5e0281fb85dadd187946ee5a89dfe8455016feb /ptyim.c | |
parent | c1ea5ba12bee50215f9ff2645434ce9f70bebce7 (diff) |
Added a delay in the im display loop so that it takes up less cpu time
Diffstat (limited to 'ptyim.c')
-rw-r--r-- | ptyim.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -6,6 +6,7 @@ #include <unistd.h> #include <errno.h> #include <string.h> +#include <time.h> #include <fcntl.h> #include <sys/ioctl.h> @@ -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 |