reordering of some things

This commit is contained in:
nova
2026-05-14 20:07:37 +02:00
parent a7d4a6322c
commit a5483335c5
2 changed files with 10 additions and 12 deletions

1
main.c
View File

@@ -81,7 +81,6 @@ int main(){
/* running through all once manually in order to get an as fast as possible first render on the screen */ /* running through all once manually in order to get an as fast as possible first render on the screen */
pthread_cond_signal(&cond_top);
pthread_cond_signal(&cond_mid); pthread_cond_signal(&cond_mid);
pthread_cond_signal(&cond_lft); pthread_cond_signal(&cond_lft);
render_pass(); render_pass();

View File

@@ -61,7 +61,6 @@ void *thread_mid(){
pthread_mutex_lock(&mutex_mid); pthread_mutex_lock(&mutex_mid);
pthread_cond_wait(&cond_mid, &mutex_mid); pthread_cond_wait(&cond_mid, &mutex_mid);
unsigned int local_status = status;
if (global_path == NULL) { if (global_path == NULL) {
mid_dir.current_file = NULL; mid_dir.current_file = NULL;
@@ -72,7 +71,7 @@ void *thread_mid(){
memcpy(path, global_path, strlen(global_path)+1); memcpy(path, global_path, strlen(global_path)+1);
if (local_status & STATUS_RELOAD_DIRECTORY) { if (status & STATUS_RELOAD_DIRECTORY) {
long index = mid_dir.current_file - mid_dir.file_list; long index = mid_dir.current_file - mid_dir.file_list;
tmp = mid_dir; tmp = mid_dir;
@@ -102,6 +101,13 @@ void *thread_mid(){
mid_dir.current_file = mid_dir.file_list; mid_dir.current_file = mid_dir.file_list;
} }
pthread_mutex_unlock(&mutex_mid);
pthread_cond_signal(&cond_top);
pthread_cond_signal(&cond_btm);
pthread_cond_signal(&cond_rgt);
/* rendering */ /* rendering */
pthread_mutex_lock(&mutex_render); pthread_mutex_lock(&mutex_render);
werase(win_m); werase(win_m);
@@ -113,13 +119,8 @@ void *thread_mid(){
wnoutrefresh(win_m); wnoutrefresh(win_m);
pthread_mutex_unlock(&mutex_render); pthread_mutex_unlock(&mutex_render);
pthread_cond_signal(&cond_top);
pthread_cond_signal(&cond_btm);
pthread_cond_signal(&cond_rgt);
pthread_mutex_unlock(&mutex_mid);
btm_status = local_status;
unsigned long i; unsigned long i;
@@ -138,7 +139,6 @@ void *thread_lft(){
while(!(status & STATUS_QUIT_PROGRAM)){ while(!(status & STATUS_QUIT_PROGRAM)){
pthread_mutex_lock(&mutex_lft); pthread_mutex_lock(&mutex_lft);
pthread_cond_wait(&cond_lft, &mutex_lft); pthread_cond_wait(&cond_lft, &mutex_lft);
unsigned int local_status = status;
if (global_path == NULL) { if (global_path == NULL) {
lft_dir.current_file = NULL; lft_dir.current_file = NULL;
@@ -154,7 +154,7 @@ void *thread_lft(){
path[strrchr(path, '/')-path] = '\0'; path[strrchr(path, '/')-path] = '\0';
path[0] = '/'; path[0] = '/';
if (local_status & STATUS_RELOAD_DIRECTORY) { if (status & STATUS_RELOAD_DIRECTORY) {
unsigned long i = 0; unsigned long i = 0;
for (i = 0; i < lft_dir.file_count; i++) { for (i = 0; i < lft_dir.file_count; i++) {
free(lft_dir.file_list[i].file_name); free(lft_dir.file_list[i].file_name);
@@ -317,10 +317,9 @@ void *thread_btm(){
while(!(status & STATUS_QUIT_PROGRAM)){ while(!(status & STATUS_QUIT_PROGRAM)){
pthread_mutex_lock(&mutex_btm); pthread_mutex_lock(&mutex_btm);
pthread_cond_wait(&cond_btm, &mutex_btm); pthread_cond_wait(&cond_btm, &mutex_btm);
unsigned int local_status = btm_status;
if (local_status & (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY)) { if (status & (STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY)) {
/*{{{ parse storage info; the fold of shame*/ /*{{{ parse storage info; the fold of shame*/
pthread_mutex_lock(&mutex_mid); pthread_mutex_lock(&mutex_mid);
unsigned long i; unsigned long i;