king2 Posted February 10, 2016 Report Share Posted February 10, 2016 I got error "ownership failure (chMtxUnlock)" while trying to call gwinSetText() from second thread (its used to display free space on USB). In trace I see that this is chDbgAssert in chMtxUnlock(), where ctp == my second thread, and ctp->p_mtxlist->m_owner pointed to flash rom area of CPU (with no name of thread).I'm creating GUI from main(), not from any thread.What I'm doing wrong? What should I do to get access to labels from any place?Thanks! Link to comment Share on other sites More sharing options...
Joel Bodenmann Posted February 10, 2016 Report Share Posted February 10, 2016 Calling gwinSetText() invokes a redraw of the corresponding widget and therefore invokes calls from the GDISP module that access the display. The GDISP API is only multi-thread safe is GDISP_NEED_MULTITHREAD has been set to TRUE in your configuration file.~ Tectu Link to comment Share on other sites More sharing options...
king2 Posted February 10, 2016 Author Report Share Posted February 10, 2016 Finally, I have found a reason. This was stack overflow in ChibiOS, but it gave me such behavior even with CH_DBG_ENABLE_STACK_CHECK turned on.. Link to comment Share on other sites More sharing options...
inmarket Posted February 10, 2016 Report Share Posted February 10, 2016 Yes, stack size is an important issue with any gui window system.For ugfx there are two stack sizes that are important... The main thread (or any other drawing thread) stack. The gtimer thread stack size.If either is too small all sorts of strange things happen. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now