update use of GPrivate
This commit is contained in:
parent
7e3494f6eb
commit
c6478c811b
|
@ -323,6 +323,7 @@ PKG_CHECK_MODULES(THREADS, glib-2.0 >= 2.32,[
|
||||||
AC_DEFINE(HAVE_MUTEX_INIT,1,[define if your glib has g_mutex_init().])
|
AC_DEFINE(HAVE_MUTEX_INIT,1,[define if your glib has g_mutex_init().])
|
||||||
AC_DEFINE(HAVE_COND_INIT,1,[define if your glib has g_cond_init().])
|
AC_DEFINE(HAVE_COND_INIT,1,[define if your glib has g_cond_init().])
|
||||||
AC_DEFINE(HAVE_THREAD_NEW,1,[define if your glib has g_thread_new().])
|
AC_DEFINE(HAVE_THREAD_NEW,1,[define if your glib has g_thread_new().])
|
||||||
|
AC_DEFINE(HAVE_PRIVATE_INIT,1,[define if your glib has G_PRIVATE_INIT().])
|
||||||
])
|
])
|
||||||
|
|
||||||
# check for gtk-doc
|
# check for gtk-doc
|
||||||
|
|
|
@ -460,7 +460,14 @@ vips_buffer_print( VipsBuffer *buffer )
|
||||||
void
|
void
|
||||||
vips__buffer_init( void )
|
vips__buffer_init( void )
|
||||||
{
|
{
|
||||||
|
#ifdef HAVE_PRIVATE_INIT
|
||||||
|
static GPrivate private =
|
||||||
|
G_PRIVATE_INIT( (GDestroyNotify) buffer_cache_free );
|
||||||
|
|
||||||
|
thread_buffer_cache_key = &private;
|
||||||
|
#else
|
||||||
if( !thread_buffer_cache_key )
|
if( !thread_buffer_cache_key )
|
||||||
thread_buffer_cache_key = g_private_new(
|
thread_buffer_cache_key = g_private_new(
|
||||||
(GDestroyNotify) buffer_cache_free );
|
(GDestroyNotify) buffer_cache_free );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ vips_g_thread_new( const char *domain, GThreadFunc func, gpointer data )
|
||||||
thread = g_thread_create( func, data, TRUE, &error );
|
thread = g_thread_create( func, data, TRUE, &error );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( !thread )
|
if( !thread ) {
|
||||||
if( error ) {
|
if( error ) {
|
||||||
vips_error( domain, "%s", error->message );
|
vips_error( domain, "%s", error->message );
|
||||||
g_error_free( error );
|
g_error_free( error );
|
||||||
|
@ -195,6 +195,7 @@ vips_g_thread_new( const char *domain, GThreadFunc func, gpointer data )
|
||||||
else
|
else
|
||||||
vips_error( domain,
|
vips_error( domain,
|
||||||
"%s", _( "unable to create thread" ) );
|
"%s", _( "unable to create thread" ) );
|
||||||
|
}
|
||||||
|
|
||||||
return( thread );
|
return( thread );
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue