Threads and progress bars not updating (no, not the one in the FA Q either!)



Hi folks,

I'm running gtk v1.2.8 on Solaris 2.6, and I'm wondering if you can help.

I've got a multi-threaded (well 2 threads!) app and the second thread is a
loader that updates a progress bar. I use the following code to do that:

  gdk_threads_enter();
  gtk_progress_set_value(GTK_PROGRESS(progressbar), posbar);
  gdk_threads_leave();

And it works fine, apart from that it "stutters" a bit. I've done this
before, so I modify me code to this:

  gdk_threads_enter();
  gtk_progress_set_value(GTK_PROGRESS(progressbar), posbar);
  gdk_threads_leave();
  while(g_main_iteration(FALSE));

This doesn't work either, as it I get this message:

GLib-WARNING **: g_main_iteration(): called recursively from within a
source's check() or prepare() member or from a second thread, iteration not
possible

It does stop the stuttering, but that really isn't the point when I get that
error message all the time.

Any ideas what I am doing wrong?

Rich




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