Make the CPU cry.
Signed-off-by: Slendi <slendi@socopon.com>
This commit is contained in:
parent
44227dc1c2
commit
88dd1f9e28
10
tmhd.c
10
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) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user