Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Main loop is blocked in the libgomp.so library #204

Closed
lc-soft opened this issue Mar 28, 2020 · 0 comments · Fixed by #205
Closed

Main loop is blocked in the libgomp.so library #204

lc-soft opened this issue Mar 28, 2020 · 0 comments · Fixed by #205

Comments

@lc-soft
Copy link
Owner

lc-soft commented Mar 28, 2020

Describe the bug
When a new main loop is created and run in the event handler, the main thread will block in libgomp.so.

To Reproduce
Steps to reproduce the behavior:

  1. Run test
  2. Waiting for test results

Expected behavior
The main thread is not blocked.

Screenshots
QQ截图20200328211728

Environment (please complete the following information):

  • LCUI version: develop branch
  • Build tools: gcc
  • OS and version: Ubuntu 18.04.3 LTS

Additional context

static void ObserverThread(void *arg)
{
LCUI_BOOL exited = *((LCUI_BOOL*)arg);
LCUI_MSleep(100);
it_b("main loop should exit after 50ms", exited, TRUE);
if (!exited) {
exit(-print_test_result());
return;
}
LCUIThread_Exit(NULL);
}
void test_mainloop(void)
{
static LCUI_BOOL exited;
LCUI_Thread tid;
LCUI_Widget root, btn;
LCUI_Init();
exited = FALSE;
btn = LCUIWidget_New("button");
root = LCUIWidget_GetRoot();
Button_SetText(btn, "button");
Widget_BindEvent(btn, "click", OnBtnClick, NULL, NULL);
Widget_Append(root, btn);
LCUIThread_Create(&tid, ObserverThread, &exited);
LCUI_SetTimeout(100, OnTriggerBtnClick, btn);
LCUI_Main();
exited = TRUE;
LCUIThread_Join(tid, NULL);
}

@lc-soft lc-soft self-assigned this Mar 28, 2020
vbalyasnyy added a commit to vbalyasnyy/LCUI that referenced this issue Mar 29, 2020
…lc-soft#204)

Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
lc-soft pushed a commit that referenced this issue Mar 30, 2020
…#204) (#205)

* fix(mainloop): move out paint event trigger from openmp parallel loop (#204)

Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>

* fix(test): fix mainloop test

 - trigger MOUSEDOWN + MOUSEUP events to push button
 - fix exited flag comparison

Signed-off-by: Vasilyy Balyasnyy <v.balyasnyy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant