improvenments to threading

This commit is contained in:
nova
2025-06-24 00:18:53 +02:00
parent 1a64b83703
commit 36ff54038e
2 changed files with 12 additions and 20 deletions

26
main.c
View File

@ -53,27 +53,23 @@ int main(){
temp_width = terminal_width;
temp_heigth = terminal_height;
}
if (status & STATUS_RUN_BACKEND || threading) {
if (status & STATUS_RUN_BACKEND) {
if (threading) {
/* temporary comment, somehow stops timing related crashes
pthread_cancel(thread_t);
pthread_cancel(thread_b);
pthread_cancel(thread_l);
pthread_cancel(thread_m);
pthread_cancel(thread_r);
*/
pthread_cancel(thread_b);
threading = 0;
status &= ~STATUS_RUN_BACKEND;
status &= ~STATUS_RELOAD_DIRECTORY;
status |= STATUS_UPDATE_SCREEN_0;
} else {
pthread_create(&thread_t, NULL, thread_top, win_t); /*top bar*/
pthread_create(&thread_b, NULL, thread_btm, win_b); /*bottom bar*/
pthread_create(&thread_m, NULL, thread_mid, win_m); /*parent_content slash win_l*/
pthread_create(&thread_l, NULL, thread_lft, win_l); /*current_content slash win_m*/
pthread_create(&thread_r, NULL, thread_rgt, win_r); /*child_content slash win_r*/
threading = 1;
}
}
pthread_create(&thread_t, NULL, thread_top, win_t); /*top bar*/
pthread_create(&thread_l, NULL, thread_lft, win_l); /*current_content slash win_m*/
pthread_create(&thread_m, NULL, thread_mid, win_m); /*parent_content slash win_l*/
pthread_create(&thread_r, NULL, thread_rgt, win_r); /*child_content slash win_r*/
pthread_create(&thread_b, NULL, thread_btm, win_b); /*bottom bar*/
threading = 1;
status &= ~(STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
status |= STATUS_UPDATE_SCREEN_0;
}
if ((input = getch())) {
user_interactions(&input, win_b);