summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlendi <slendi@socopon.com>2023-09-09 14:39:29 +0300
committerSlendi <slendi@socopon.com>2023-09-09 14:39:29 +0300
commit88dd1f9e28a6216216f3e29c27302f0f968be589 (patch)
tree47185bc815fd537f5f0a646849309dd0ae1ba55c
parent44227dc1c2eda243d3a54d215d0f4e64587a677f (diff)
Make the CPU cry.
Signed-off-by: Slendi <slendi@socopon.com>
-rw-r--r--tmhd.c10
1 files changed, 9 insertions, 1 deletions
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 <ctype.h>
@@ -15,6 +15,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/sysinfo.h>
#include <time.h>
#include <unistd.h>
@@ -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) {