Re: Pthreads messes up interface
- From: Paul Davis <pbd Op Net>
- To: Mattias Persson <matper-8 webmail student luth se>
- Cc: gtk-list gnome org
- Subject: Re: Pthreads messes up interface
- Date: Thu, 26 Jul 2001 13:14:19 -0400
>//(this is gtk_main pthread)
>pthread_t my_new_thread;
>
>void start_auto(GtkToggleButton *tb, gpointer ud){
> pthread_create(&my_new_thread, NULL, auto_update,
>NULL);
>}
>
>void auto_update(){
> while(var == 1){ //variable will be changed from other
> //pthread.
> do_stuff(); //stuff will emitt signals that
> //affect user interface in
> //gtk_main pthread.
> sleep(1);
> }
>}
1) Read the FAQ at www.gtk.org
2) when you emit signals, do the handlers make GTK+ calls?
if so, you need to use the GDK_THREAD_ENTER/LEAVE paradigm, or
redesign your application so that my_new_thread never calls GTK or GDK
or Xlib.
--p
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]