mirror of
https://github.com/transmission/transmission
synced 2025-02-03 04:53:27 +00:00
shut down the libevent thread gracefully on shutdown
This commit is contained in:
parent
0c60e29934
commit
34e8174ee8
1 changed files with 6 additions and 1 deletions
|
@ -63,12 +63,14 @@ tr_peerIdNew ( char * buf, int buflen )
|
||||||
buf[TR_ID_LEN] = '\0';
|
buf[TR_ID_LEN] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int shuttingDown = FALSE;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
libeventThreadFunc( void * unused UNUSED )
|
libeventThreadFunc( void * unused UNUSED )
|
||||||
{
|
{
|
||||||
tr_dbg( "libevent thread starting" );
|
tr_dbg( "libevent thread starting" );
|
||||||
event_init( );
|
event_init( );
|
||||||
for ( ;; )
|
while( !shuttingDown )
|
||||||
{
|
{
|
||||||
event_dispatch( );
|
event_dispatch( );
|
||||||
tr_wait( 50 ); /* 1/20th of a second */
|
tr_wait( 50 ); /* 1/20th of a second */
|
||||||
|
@ -246,6 +248,9 @@ void tr_close( tr_handle_t * h )
|
||||||
free( h );
|
free( h );
|
||||||
|
|
||||||
tr_netResolveThreadClose();
|
tr_netResolveThreadClose();
|
||||||
|
|
||||||
|
/* end the event thread */
|
||||||
|
shuttingDown = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
tr_torrent_t **
|
tr_torrent_t **
|
||||||
|
|
Loading…
Reference in a new issue