flock implemented
This commit is contained in:
@@ -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
|
Same as plugins. Just write in more features scrub, learn some C, damn
|
||||||
|
|
||||||
## TODOs
|
## TODOs
|
||||||
- implement flock
|
|
||||||
- GPU power is jumpy, average? Use accumulator instead?
|
- 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
|
- 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
|
- Maybe not even screens, keep the 1st line and change lines 2-4
|
||||||
|
|||||||
13
src/main.c
13
src/main.c
@@ -171,15 +171,19 @@ static void *display_thread(void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
control.g_running = true;
|
applog(LOG_START, "linuxSmartie starting");
|
||||||
applog(LOG_START, "linuxSmartie started");
|
|
||||||
applog(LOG_DBG, "Compiled on %s %s with %s", __DATE__, __TIME__, C_STD);
|
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) {
|
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));
|
applog(LOG_ERR, "can't allocate mem for the sensor struct. You don't got %lu bytes bro?", sizeof(struct sensors_t));
|
||||||
free(sensors);
|
free(sensors);
|
||||||
return -1;
|
return 2;
|
||||||
}
|
}
|
||||||
applog(LOG_INF, "sensor struct allocated, size is %lu bytes", sizeof(struct sensors_t));
|
applog(LOG_INF, "sensor struct allocated, size is %lu bytes", sizeof(struct sensors_t));
|
||||||
|
|
||||||
@@ -196,6 +200,7 @@ int main(void) {
|
|||||||
/* control vars setup */
|
/* control vars setup */
|
||||||
pthread_mutex_init(&control.sensors_mtx, NULL);
|
pthread_mutex_init(&control.sensors_mtx, NULL);
|
||||||
pthread_cond_init(&control.sensors_ready, NULL);
|
pthread_cond_init(&control.sensors_ready, NULL);
|
||||||
|
control.g_running = true;
|
||||||
|
|
||||||
/* thread setup */
|
/* thread setup */
|
||||||
pthread_t sensors_pthread;
|
pthread_t sensors_pthread;
|
||||||
|
|||||||
Reference in New Issue
Block a user