comparison src/gtk/transfer.c @ 33:c8ec7877432e

2002-10-06 Brian Masney <masneyb@gftp.org> * src/gtk/delete_dialog.c, src/gtk/gftp-gtk.c, src/gtk/misc-gtk.c, src/gtk/transfer.c - Fixed dead-locks with GDK_THREADS_{ENTER,LEAVE} * configure.in, src/gtk/Makefile.am - Use GTHREAD_LIBS 2002-10-03 Brian Masney <masneyb@gftp.org> * Makefile.am - remove intl and m4 directory from subdirs. autogen.sh will automagically add these for me. * autogen.sh - remove check for libtool * configure.in - link in gthread * cvsclean - added this script * *.[ch] - added $Id$ tags * debian/* - updated files from Debian maintainer
author masneyb
date Mon, 07 Oct 2002 10:40:43 +0000
parents d930e06af9ae
children bc9473ba9a90
comparison
equal deleted inserted replaced
32:741f7aefa9aa 33:c8ec7877432e
16 /* along with this program; if not, write to the Free Software */ 16 /* along with this program; if not, write to the Free Software */
17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ 17 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
18 /*****************************************************************************/ 18 /*****************************************************************************/
19 19
20 #include <gftp-gtk.h> 20 #include <gftp-gtk.h>
21 static const char cvsid[] = "$Id$";
21 22
22 static void *getdir_thread ( void *data ); 23 static void *getdir_thread ( void *data );
23 static void *connect_thread ( void *data ); 24 static void *connect_thread ( void *data );
24 static void on_next_transfer ( gftp_transfer * tdata ); 25 static void on_next_transfer ( gftp_transfer * tdata );
25 static void show_transfer ( gftp_transfer * tdata ); 26 static void show_transfer ( gftp_transfer * tdata );
68 { 69 {
69 guint handler; 70 guint handler;
70 void *success; 71 void *success;
71 72
72 gtk_label_set (GTK_LABEL (wdata->hoststxt), _("Receiving file names...")); 73 gtk_label_set (GTK_LABEL (wdata->hoststxt), _("Receiving file names..."));
73 fix_display (); 74 if (gftp_is_started)
75 fix_display ();
76
74 wdata->show_selected = 0; 77 wdata->show_selected = 0;
75 if (wdata->files == NULL) 78 if (wdata->files == NULL)
76 { 79 {
77 if (check_reconnect (wdata) < 0) 80 if (check_reconnect (wdata) < 0)
78 return (0); 81 return (0);
85 88
86 handler = setup_wakeup_main_thread (wdata->request); 89 handler = setup_wakeup_main_thread (wdata->request);
87 pthread_create (&wdata->tid, NULL, getdir_thread, wdata->request); 90 pthread_create (&wdata->tid, NULL, getdir_thread, wdata->request);
88 while (wdata->request->stopable) 91 while (wdata->request->stopable)
89 { 92 {
90 gdk_threads_leave (); 93 GDK_THREADS_LEAVE ();
91 g_main_iteration (TRUE); 94 g_main_iteration (TRUE);
92 gdk_threads_enter ();
93 } 95 }
94 teardown_wakeup_main_thread (wdata->request, handler); 96 teardown_wakeup_main_thread (wdata->request, handler);
95 97
96 pthread_join (wdata->tid, &success); 98 pthread_join (wdata->tid, &success);
97 gtk_widget_set_sensitive (stop_btn, 0); 99 gtk_widget_set_sensitive (stop_btn, 0);
258 try_connect_again, request, 260 try_connect_again, request,
259 dont_connect_again, request); 261 dont_connect_again, request);
260 262
261 while (request->stopable) 263 while (request->stopable)
262 { 264 {
263 gdk_threads_leave (); 265 GDK_THREADS_LEAVE ();
264 g_main_iteration (TRUE); 266 g_main_iteration (TRUE);
265 gdk_threads_enter ();
266 } 267 }
267 268
268 if (GFTP_GET_PASSWORD (request) == NULL || 269 if (GFTP_GET_PASSWORD (request) == NULL ||
269 *GFTP_GET_PASSWORD (request) == '\0') 270 *GFTP_GET_PASSWORD (request) == '\0')
270 return (0); 271 return (0);
282 pthread_create (&wdata->tid, NULL, connect_thread, request); 283 pthread_create (&wdata->tid, NULL, connect_thread, request);
283 284
284 handler = setup_wakeup_main_thread (wdata->request); 285 handler = setup_wakeup_main_thread (wdata->request);
285 while (request->stopable) 286 while (request->stopable)
286 { 287 {
287 gdk_threads_leave (); 288 GDK_THREADS_LEAVE ();
288 g_main_iteration (TRUE); 289 g_main_iteration (TRUE);
289 gdk_threads_enter ();
290 } 290 }
291 pthread_join (wdata->tid, &ret); 291 pthread_join (wdata->tid, &ret);
292 teardown_wakeup_main_thread (wdata->request, handler); 292 teardown_wakeup_main_thread (wdata->request, handler);
293 293
294 gtk_widget_set_sensitive (stop_btn, 0); 294 gtk_widget_set_sensitive (stop_btn, 0);
448 448
449 timeout_num = gtk_timeout_add (100, progress_timeout, transfer); 449 timeout_num = gtk_timeout_add (100, progress_timeout, transfer);
450 450
451 while (transfer->fromreq->stopable) 451 while (transfer->fromreq->stopable)
452 { 452 {
453 gdk_threads_leave (); 453 GDK_THREADS_LEAVE ();
454 g_main_iteration (TRUE); 454 g_main_iteration (TRUE);
455 gdk_threads_enter ();
456 } 455 }
457 456
458 gtk_timeout_remove (timeout_num); 457 gtk_timeout_remove (timeout_num);
459 transfer->numfiles = transfer->numdirs = -1; 458 transfer->numfiles = transfer->numdirs = -1;
460 update_directory_download_progress (transfer); 459 update_directory_download_progress (transfer);
1206 file_transfers = g_list_remove_link (file_transfers, node); 1205 file_transfers = g_list_remove_link (file_transfers, node);
1207 pthread_mutex_unlock (&transfer_mutex); 1206 pthread_mutex_unlock (&transfer_mutex);
1208 pthread_mutex_destroy (tdata->structmutex); 1207 pthread_mutex_destroy (tdata->structmutex);
1209 pthread_mutex_destroy (tdata->statmutex); 1208 pthread_mutex_destroy (tdata->statmutex);
1210 free_tdata (tdata); 1209 free_tdata (tdata);
1211 fix_display ();
1212 } 1210 }
1213 1211
1214 1212
1215 static void 1213 static void
1216 create_transfer (gftp_transfer * tdata) 1214 create_transfer (gftp_transfer * tdata)