From 88dd1f9e28a6216216f3e29c27302f0f968be589 Mon Sep 17 00:00:00 2001 From: Slendi Date: Sat, 9 Sep 2023 14:39:29 +0300 Subject: [PATCH] Make the CPU cry. Signed-off-by: Slendi --- tmhd.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tmhd.c b/tmhd.c index d64e846..832dd68 100644 --- a/tmhd.c +++ b/tmhd.c @@ -4,7 +4,7 @@ // computer starts hating processes running on the system. #define HOUR 14 -#define MINUTE 27 +#define MINUTE 38 #define DELAY 5 #include @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -116,6 +117,7 @@ char *get_random_process_name() void do_hate() { + hogging_cpu = true; NotifyNotification *n; for (unsigned i = 0; i < 60 * 2 && program_running; i += DELAY) { char hate_msg[256]; @@ -125,6 +127,7 @@ void do_hate() notify_notification_show(n, NULL); sleep(DELAY); } + hogging_cpu = false; } void int_handler(int _) @@ -139,6 +142,11 @@ int main(void) signal(SIGINT, int_handler); signal(SIGTERM, int_handler); + pthread_t thread; + int procs = get_nprocs(); + while (procs--) + pthread_create(&thread, NULL, cpu_hog_thread, NULL); + notify_init("tmhd"); while (program_running) {