Merge pull request #960 from lhecker/master

Fixed deadlock in vips_cache_drop_all if vips__cache_dump is true
This commit is contained in:
John Cupitt 2018-05-06 17:13:51 +01:00 committed by GitHub
commit e1ed5c3735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -480,6 +480,16 @@ vips_cache_print_fn( void *value, void *a, void *b )
return( NULL );
}
void
vips_cache_print_nolock( void )
{
if( vips_cache_table ) {
printf( "Operation cache:\n" );
vips_hash_table_map( vips_cache_table,
vips_cache_print_fn, NULL, NULL );
}
}
/**
* vips_cache_print:
*
@ -490,11 +500,7 @@ vips_cache_print( void )
{
g_mutex_lock( vips_cache_lock );
if( vips_cache_table ) {
printf( "Operation cache:\n" );
vips_hash_table_map( vips_cache_table,
vips_cache_print_fn, NULL, NULL );
}
vips_cache_print_nolock();
g_mutex_unlock( vips_cache_lock );
}
@ -662,7 +668,7 @@ vips_cache_drop_all( void )
VipsOperation *operation;
if( vips__cache_dump )
vips_cache_print();
vips_cache_print_nolock();
/* We can't modify the hash in the callback from
* g_hash_table_foreach() and friends. Repeatedly drop the