Beispiel #1
0
static VipsBufferThread *
buffer_thread_get( void )
{
	VipsBufferThread *buffer_thread;

	if( !(buffer_thread = g_private_get( buffer_thread_key )) ) {
		buffer_thread = buffer_thread_new();
		g_private_set( buffer_thread_key, buffer_thread );
	}

	g_assert( buffer_thread->thread == g_thread_self() ); 

	return( buffer_thread );
}
Beispiel #2
0
/* Get our private VipsBufferThread. NULL for non-worker threads.
 */
static VipsBufferThread *
buffer_thread_get( void )
{
	VipsBufferThread *buffer_thread;

	if( vips_thread_isworker() ) {
		/* Workers get a private set of buffers.
		 */
		if( !(buffer_thread = g_private_get( buffer_thread_key )) ) {
			buffer_thread = buffer_thread_new();
			g_private_set( buffer_thread_key, buffer_thread );
		}

		g_assert( buffer_thread->thread == g_thread_self() ); 
	}
	else 
		/* Non-workers don't have one. 
		 */
		buffer_thread = NULL; 

	return( buffer_thread );
}