cleanup
This commit is contained in:
20
src/main.c
20
src/main.c
@@ -1,22 +1,23 @@
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include <stdlib.h>
|
||||
#include "log.h"
|
||||
#include <unistd.h>
|
||||
#include <stdatomic.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/signalfd.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "lcd.h"
|
||||
#include "log.h"
|
||||
#include "cpu.h"
|
||||
#include "gpu.h"
|
||||
#include "sys.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wunused-result"
|
||||
|
||||
static constexpr uint16_t refresh_interval_ms = 500;
|
||||
static constexpr char netif[] = "enp7s0";
|
||||
static constexpr char cpu_pcidev[] = "0000:00:18.3";
|
||||
static constexpr char gpu_pcidev[] = "0000:0a:00.0";
|
||||
|
||||
struct control_t {
|
||||
pthread_mutex_t sensors_mtx;
|
||||
@@ -44,9 +45,9 @@ static void *sensors_thread(void *arg) {
|
||||
|
||||
// set up paths for the sensors
|
||||
strcpy(sensors->home.mountpoint, "/home/drath");
|
||||
strcpy(sensors->net.device, "enp7s0");
|
||||
cpu_detect(&sensors->cpu, "0000:00:18.3");
|
||||
gpu_detect(&sensors->gpu, "0000:0a:00.0");
|
||||
strcpy(sensors->net.device, netif);
|
||||
cpu_detect(&sensors->cpu, cpu_pcidev);
|
||||
gpu_detect(&sensors->gpu, gpu_pcidev);
|
||||
sys_detect(&sensors->sys, "nct6775.656");
|
||||
|
||||
while (control.g_running) { // NOLINT
|
||||
@@ -186,7 +187,8 @@ int main(void) {
|
||||
pthread_create(&display_pthread, nullptr, display_thread, sensors);
|
||||
pthread_create(&sensors_pthread, nullptr, sensors_thread, sensors);
|
||||
|
||||
read(sfd, &info, sizeof(info)); // halts on this until SIGTERM
|
||||
const ssize_t ret = read(sfd, &info, sizeof(info)); // halts on this until SIGTERM
|
||||
(void)ret;
|
||||
|
||||
/* cleanup on exit signal */
|
||||
applog(LOG_WRN, "got stop signal, shutting down...");
|
||||
|
||||
Reference in New Issue
Block a user