Re: [gtkmm] mult-thread support



> Hi,
>

Hello.

> 	I recently switched from writting gtk+ apps in C to C++.  In C
> I would typically just use straight pthread function calls to create 
> multi-threads and this worked fine with gtk.  I would simply make calls
> to gdk_threads_enter and gdk_threads_leave around any critical gtk 
> calls.  Now that I'm working in C++ with gtkmm i thought i might try
> a similar approach however to my dismay this doesn't seem to be working.
> I'm getting the following crash error message:
> 
> "Xlib: unexpected async reply (sequence 0x2406)!"

It's a very bad idea to make GUI calls from more than one thread.  This
works sometimes in C, but seldom works from gtkmm.  The standard wisdom 
is to have your worker threads send signals (pipes work well here) to the 
GUI thread, which does all the gtkmm calls.

I (and many others on the list) have thread wrappers which do this for
us.  I can share mine of you like.

cheers,
--
joey yandle                             ___====-_  _-====___
www.divisionbyzero.com            _--~~~#####//      \\#####~~~--_
/jwy/pubkey.asc                _-~##########// (    ) \\##########~-_
                              -############//  :\^^/:  \\############-
                            _~############//   (@::@)   \\############~_
                           ~#############((     \\//     ))#############~
                          -###############\\    (^^)    //###############-
                         -#################\\  / "" \  //#################-
                        -###################\\/      \//###################-
                       _#/:##########/\######(   /\   )######/\##########:\#_
                       :/ :#/\#/\#/\/  \#/\##\  :  :  /##/\#/  \/\#/\#/\#: \:
                       "  :/  V  V  "   V  \#\: :  : :/#/  V   "  V  V  \:  "
                          "   "  "      "   \ : :  : : /   "      "  "   "




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]