attempted multithreadded rendering
This commit is contained in:
56
main.c
56
main.c
@@ -31,6 +31,12 @@ WINDOW *win_l;
|
||||
WINDOW *win_m;
|
||||
WINDOW *win_r;
|
||||
|
||||
extern pthread_mutex_t mutex_top;
|
||||
extern pthread_mutex_t mutex_btm;
|
||||
extern pthread_mutex_t mutex_lft;
|
||||
extern pthread_mutex_t mutex_mid;
|
||||
extern pthread_mutex_t mutex_rgt;
|
||||
|
||||
char *input; /*used in user_interactions*/
|
||||
char *terminal_width_empty_line; /* used in user_interactions */
|
||||
|
||||
@@ -154,21 +160,41 @@ void render_pass(){
|
||||
|
||||
}
|
||||
if (status & STATUS_UPDATE_SCREEN_MASK) {
|
||||
werase(win_t);
|
||||
werase(win_l);
|
||||
werase(win_m);
|
||||
werase(win_r);
|
||||
werase(win_b);
|
||||
window_top(win_t);
|
||||
window_lft(win_l);
|
||||
window_mid(win_m);
|
||||
window_rgt(win_r);
|
||||
window_btm(win_b);
|
||||
wnoutrefresh(win_t);
|
||||
wnoutrefresh(win_l);
|
||||
wnoutrefresh(win_m);
|
||||
wnoutrefresh(win_r);
|
||||
wnoutrefresh(win_b);
|
||||
if (pthread_mutex_trylock(&mutex_top) == 0) {
|
||||
wnoutrefresh(win_t);
|
||||
pthread_mutex_unlock(&mutex_top);
|
||||
} else {
|
||||
mvwaddstr(win_t, terminal_height/2, terminal_width/4, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_GENERIC;
|
||||
}
|
||||
if (pthread_mutex_trylock(&mutex_rgt) == 0) {
|
||||
wnoutrefresh(win_r);
|
||||
pthread_mutex_unlock(&mutex_rgt);
|
||||
} else {
|
||||
mvwaddstr(win_r, terminal_height/2, terminal_width/4, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_GENERIC;
|
||||
}
|
||||
if (pthread_mutex_lock(&mutex_mid) == 0) {
|
||||
wnoutrefresh(win_m);
|
||||
pthread_mutex_unlock(&mutex_mid);
|
||||
} else {
|
||||
mvwaddstr(win_m, terminal_height/2, terminal_width/4, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_GENERIC;
|
||||
}
|
||||
if (pthread_mutex_trylock(&mutex_lft) == 0) {
|
||||
wnoutrefresh(win_l);
|
||||
pthread_mutex_unlock(&mutex_lft);
|
||||
} else {
|
||||
mvwaddstr(win_l, terminal_height/2, terminal_width/4, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_GENERIC;
|
||||
}
|
||||
if (pthread_mutex_trylock(&mutex_btm) == 0) {
|
||||
wnoutrefresh(win_b);
|
||||
pthread_mutex_unlock(&mutex_btm);
|
||||
} else {
|
||||
mvwaddstr(win_b, terminal_height/2, terminal_width/4, "LOADING");
|
||||
status |= STATUS_UPDATE_SCREEN_GENERIC;
|
||||
}
|
||||
doupdate();
|
||||
status &= ~(STATUS_UPDATE_SCREEN_MASK - STATUS_UPDATE_SCREEN_DIR_CHANGE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user