Re: Pthreads with GTK 1.2



Hi again

I cannot use the g_thread_init function because I am working with gtk 1.2, as far as I read, I saw that this 
function is only used with gtk 2.0

Do you have any suggestions about this topic?  

Thanks in advance and best regards

Boris

P.D. Sorry for my bad english.

On 10 Jan 2003 15:14:42 +0100
Philip Van Hoof <spamfrommailing freax org> wrote:

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>

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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