Changeset 9880
- Timestamp:
- Jan 4, 2010, 11:06:34 PM (11 years ago)
- Location:
- branches/1.7x
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.7x/gtk/main.c
r9358 r9880 628 628 } 629 629 630 static g pointer631 quitThreadFunc( gpointer gdata )630 static gboolean 631 onSessionClosed( gpointer gdata ) 632 632 { 633 633 struct cbdata * cbdata = gdata; 634 gdk_threads_enter( );635 636 tr_core_close( cbdata->core );637 634 638 635 /* shutdown the gui */ … … 659 656 660 657 gtk_main_quit( ); 658 659 return FALSE; 660 } 661 662 static gpointer 663 sessionCloseThreadFunc( gpointer gdata ) 664 { 665 /* since tr_sessionClose() is a blocking function, 666 * call it from another thread... when it's done, 667 * punt the GUI teardown back to the GTK+ thread */ 668 struct cbdata * cbdata = gdata; 669 gdk_threads_enter( ); 670 tr_core_close( cbdata->core ); 671 gtr_idle_add( onSessionClosed, gdata ); 661 672 gdk_threads_leave( ); 662 663 673 return NULL; 664 674 } … … 727 737 728 738 /* shut down libT */ 729 g_thread_create( quitThreadFunc, vdata, TRUE, NULL );739 g_thread_create( sessionCloseThreadFunc, vdata, TRUE, NULL ); 730 740 } 731 741 -
branches/1.7x/libtransmission/session.c
r8967 r9880 1505 1505 } 1506 1506 1507 #define SHUTDOWN_MAX_SECONDS 301507 #define SHUTDOWN_MAX_SECONDS 20 1508 1508 1509 1509 void … … 1521 1521 while( !session->isClosed && !deadlineReached( deadline ) ) 1522 1522 { 1523 dbgmsg( 1524 "waiting for the shutdown commands to run in the main thread" ); 1523 dbgmsg( "waiting for the libtransmission thread to finish" ); 1525 1524 tr_wait( 100 ); 1526 1525 } … … 1542 1541 /* close the libtransmission thread */ 1543 1542 tr_eventClose( session ); 1544 while( session->events && !deadlineReached( deadline ) ) 1545 { 1546 dbgmsg( "waiting for the libevent thread to shutdown cleanly" ); 1543 while( session->events != NULL ) 1544 { 1545 static tr_bool forced = FALSE; 1546 dbgmsg( "waiting for libtransmission thread to finish" ); 1547 1547 tr_wait( 100 ); 1548 if( deadlineReached( deadline ) && !forced ) 1549 { 1550 event_loopbreak( ); 1551 forced = TRUE; 1552 } 1548 1553 } 1549 1554
Note: See TracChangeset
for help on using the changeset viewer.