[gtkmm] mult-thread support
- From: Todd Fisher <taf2 lehigh edu>
- To: gtkmm-list gnome org
- Subject: [gtkmm] mult-thread support
- Date: Mon, 30 Jun 2003 11:56:15 -0400
Hi,
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)!"
The application does not die but from there on does not behave as
expected. Basically, I'd just like to create a new thread that does
some work and updates a scale. The simplist way to do that
i would think is as follows:
1. create main window Gtk::Window code
2. spawn worker thread pthread_create( ..., myfunc, my_scal_widget );
--- 3. main thread is idle giving user ablity to cancel busy task
--- 4. worker thread updates scale widget until work is complete
myfunc(...){
...
my_scale_widget->set_value( new_value );
...
}
3 and 4 happen in parrallel of course.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]