Pthreads with GTK 1.2



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.

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



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