summaryrefslogtreecommitdiff
path: root/ptyim.c
diff options
context:
space:
mode:
authorHaoran S. Diao (刁浩然) <0@hairydiode.xyz>2025-09-13 03:36:56 -0700
committerHaoran S. Diao (刁浩然) <0@hairydiode.xyz>2025-09-13 03:36:56 -0700
commit2395ce8c7fc19f937bbddbe309a2a9ea937a3b86 (patch)
treef5e0281fb85dadd187946ee5a89dfe8455016feb /ptyim.c
parentc1ea5ba12bee50215f9ff2645434ce9f70bebce7 (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.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ptyim.c b/ptyim.c
index 787581e..599eee3 100644
--- a/ptyim.c
+++ b/ptyim.c
@@ -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