wxWidget error, [error due to thread concept]
i m using wxWidget and there i m using wxThread, some time things going good, sometime开发者_如何学编程 give unexpected result.... once i got error like:-
ass8-1-login_report: pthread_mutex_lock.c:62: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.
please anybody can tell me what is the meaning of this error
Pthread mutex assertion error
Update: You are probably accessing the wx GUI from another thread than the main thread. Never call any GUI related functions or instantiate any wxWidgets GUI elements from any other thread except the main thread.
In some cases, it may be possible to access the GUI from another thread if the accesses to the GUI are wrapped with calls to wxMutexGUIEnter and wxMutexGUILeave, but it is not recommended.
Basicially problem was Thread, wxThread, by default thread is Detatched , it automatically delete when finish working. here during thread alive when we check
if( obj->IsAlive())
, no problem but when thread end then we checked this
` if(obj -> IsAlive ) showing problem because when thread delete , there are no object of thread.still we are checking this. [ it was the main problme ]. i use a extern variable to check thread is live or dead , now my code is working fine
精彩评论