Wed, 23 Oct 2024 17:16:51 +0200
fix condvar and dialog window content area
ui/common/condvar.c | file | annotate | diff | comparison | revisions | |
ui/common/condvar.h | file | annotate | diff | comparison | revisions | |
ui/gtk/window.c | file | annotate | diff | comparison | revisions |
--- a/ui/common/condvar.c Wed Oct 23 16:34:08 2024 +0200 +++ b/ui/common/condvar.c Wed Oct 23 17:16:51 2024 +0200 @@ -34,6 +34,7 @@ UiPosixCondVar *var = malloc(sizeof(UiPosixCondVar)); var->var.data = NULL; var->var.intdata = 0; + var->set = 0; pthread_mutex_init(&var->lock, NULL); pthread_cond_init(&var->cond, NULL); return (UiCondVar*)var; @@ -42,7 +43,10 @@ void ui_condvar_wait(UiCondVar *var) { UiPosixCondVar *p = (UiPosixCondVar*)var; pthread_mutex_lock(&p->lock); - pthread_cond_wait(&p->cond, &p->lock); + if(!p->set) { + pthread_cond_wait(&p->cond, &p->lock); + } + p->set = 0; pthread_mutex_unlock(&p->lock); } @@ -52,6 +56,7 @@ pthread_mutex_lock(&p->lock); p->var.data = data; p->var.intdata = intdata; + p->set = 1; pthread_cond_signal(&p->cond); pthread_mutex_unlock(&p->lock); }