Pthreads messes up interface



Hi!
I run my gtk_main() in a normal pthread which works 
just fine. But when i from that thread try to start 
another (default) pthread that does stuff that affects 
the interface it won't redraw properly.
The code is kind of like this:

//(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);
  }
}

What am I doing wrong?

Thx /Mattias




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