Skip to content

Commit

Permalink
attempt to solve redraw related hangs
Browse files Browse the repository at this point in the history
a mutex didnt work out so now its spinlock guarded, hopefully this
solves the few rare cases of hanging mentioned in #31
  • Loading branch information
Ckath committed Jul 2, 2021
1 parent 7d61e5f commit 311186c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ handle_chld()
static void
handle_redraw()
{
extern pthread_spinlock_t redraw_lock;
pthread_spin_lock(&redraw_lock);
sendwin();
srefresh();

Expand All @@ -71,6 +73,7 @@ handle_redraw()
cancel_preview();
refresh_layout();
}
pthread_spin_unlock(&redraw_lock);
}

static void
Expand Down Expand Up @@ -113,6 +116,8 @@ init()
init_colors();

/* init fuf */
extern pthread_spinlock_t redraw_lock; /* not the right place for this */
pthread_spin_init(&redraw_lock, PTHREAD_PROCESS_SHARED); /* , whatever */
handle_redraw();
start_load(load_items, display_load);
init_preview(load_preview);
Expand Down

0 comments on commit 311186c

Please sign in to comment.