hello & threads



hi all

well i have a problem with an application i'm writing. I have 2
threads. The first one creates an empty window with a button and calls
gtk_main(). The second one does this:

void  secondThread(){

  char str[100];
  int i=0;

  while(TRUE) {
    
    // here i create a string
    sprintf(str, "%d\n", i++);

    // and here I change the button label
    if (window != NULL)
      gtk_button_set_label(GTK_BUTTON(button), str);

    // once a second    
    g_usleep(1000000);
  }
}

well the thread is quite simple. But when i launch the program the
button changes its label 3 or 4 times and then becomes blank.

I well, i have been using gtk for a time and i have never had this
problem. can you tell me what i am doing wrong??

thanks for your help.



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