Re: GUI still hanging...



Paul Barton-Davis wrote:
> Sorry, this is wrong. This loop will simply flush out existing events,
> and then breaks...

Yup, you're right. That while loop never ran even
once. However, what I ended up doing was making
an int* that I set to 1 before running my thread
and then I do my while loop testing that integer.
Once my thread completes, I set my int* to 0
and the while loop quits and pthread_join() is
called. This seems to work! I'm very happy. Here's
my code below. I'm not sure if this is very efficient,
but it seems a tad simpler than using pipes. Thanks
for your help, though!

   *connecting = 1;
   pthread_create(&rwin->tid, NULL, ftp_connect_thread,
                  (void *)connecting);
   gtk_button_leave(GTK_BUTTON(toolbar->cd_button));
   while(*connecting)
   {
      g_main_iteration(FALSE);
   }
   pthread_join(rwin->tid, &thread_ret);

-- 
+-----------------------------------------------------+
| Jeff "Shippy" Shipman     E-Mail: shippy@cs.nmt.edu |
| Computer Science Major    ICQ: 1786493              |
| New Mexico Institute of Mining and Technology       |
| Homepage: http://www.nmt.edu/~shippy                |
+-----------------------------------------------------+




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