Re: Pthreads with GTK 1.2



On Fri, 2003-01-10 at 15:09, Boris wrote:
Hi

I am trying to show/hide a window from a separated thread. This thread was created with pthread_create 
function. The show action works fine.  The problem is the hide action, it never launchs, my window
is visible all the time.

Add 

g_thread_init(NULL);

at the top of the int main() function



Here is some of my code, the thread function :

gpointer verificar()
{
      int h=0;
      int cargo=0;

      while (1)
      {
              h = fileexists("/myfile");  
              if (h)
              {
                      if (!cargo)
                      {
                              do_args_tag = gtk_idle_add(do_args, (gpointer)0);   //load the file
                              cargo = 1;
                      }
                      gtk_widget_show(window);
              }
              else
              {
                              gtk_widget_hide(window);
                              cargo=0;
              }
      }
      pthread_exit(0);
}

main( ...)
{
    ....
    pthread_t t1;
    pthread_create(&t1,NULL,verificar,NULL);
    ...

    gtk_main();
}

Any help will be appreciated

Thanks in advance and best regards

Boris
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
-- 
Philip Van Hoof <spamfrommailing freax org>




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