Swap g_private_set with g_private_replace where possible
There's a possibility that the old GDestroyNotify handler is not called when threads are being reused.
This commit is contained in:
parent
8b01104c67
commit
91a143e5c9
|
@ -245,15 +245,13 @@ vips__thread_profile_attach( const char *thread_name )
|
|||
|
||||
VIPS_DEBUG_MSG( "vips__thread_profile_attach: %s\n", thread_name );
|
||||
|
||||
g_assert( !g_private_get( vips_thread_profile_key ) );
|
||||
|
||||
profile = g_new( VipsThreadProfile, 1 );
|
||||
profile->name = thread_name;
|
||||
profile->gates = g_hash_table_new_full(
|
||||
g_direct_hash, g_str_equal,
|
||||
NULL, (GDestroyNotify) vips_thread_gate_free );
|
||||
profile->memory = vips_thread_gate_new( "memory" );
|
||||
g_private_set( vips_thread_profile_key, profile );
|
||||
g_private_replace( vips_thread_profile_key, profile );
|
||||
}
|
||||
|
||||
static VipsThreadProfile *
|
||||
|
|
|
@ -201,7 +201,8 @@ vips_thread_main_loop( gpointer thread_data, gpointer pool_data )
|
|||
VipsThreadExec *exec = (VipsThreadExec *) thread_data;
|
||||
|
||||
/* Set this to something (anything) to tag this thread as a vips
|
||||
* worker.
|
||||
* worker. No need to call g_private_replace as there is no
|
||||
* GDestroyNotify handler associated with a worker.
|
||||
*/
|
||||
g_private_set( is_worker_key, thread_data );
|
||||
|
||||
|
|
Loading…
Reference in New Issue