flock implemented

This commit is contained in:
2026-05-24 12:29:59 +02:00
parent 6524ce346f
commit a6a1a58bcf
2 changed files with 9 additions and 5 deletions

View File

@@ -10,7 +10,6 @@ Alphanumeric LCD controller software for Linux (kind of LCDSmartie for Windows b
Same as plugins. Just write in more features scrub, learn some C, damn
## TODOs
- implement flock
- GPU power is jumpy, average? Use accumulator instead?
- Extra screens support perhaps? just halt sensors monitoring thread and print another struct on display if needed, have a semaphore or sth
- Maybe not even screens, keep the 1st line and change lines 2-4

View File

@@ -171,15 +171,19 @@ static void *display_thread(void *arg) {
}
int main(void) {
control.g_running = true;
applog(LOG_START, "linuxSmartie started");
applog(LOG_START, "linuxSmartie starting");
applog(LOG_DBG, "Compiled on %s %s with %s", __DATE__, __TIME__, C_STD);
struct sensors_t *sensors = malloc(sizeof(*sensors)); // no actual point in mallocing and it is ever so sligtly slower to access heap vs stack, but its cool
/* see if another instance is up, quit if it is */
if (get_instance_lock() < 0)
return 1;
/* malloc memory for the struct */
struct sensors_t *sensors = malloc(sizeof(*sensors)); // no actual point in mallocing and it is ever so sligtly slower to access heap vs stack, but its cool
if (sensors == NULL) {
applog(LOG_ERR, "can't allocate mem for the sensor struct. You don't got %lu bytes bro?", sizeof(struct sensors_t));
free(sensors);
return -1;
return 2;
}
applog(LOG_INF, "sensor struct allocated, size is %lu bytes", sizeof(struct sensors_t));
@@ -196,6 +200,7 @@ int main(void) {
/* control vars setup */
pthread_mutex_init(&control.sensors_mtx, NULL);
pthread_cond_init(&control.sensors_ready, NULL);
control.g_running = true;
/* thread setup */
pthread_t sensors_pthread;