inherit scheduling priority on any created thread
[melted] / src / modules / avformat / consumer_avformat.c
index 4b64d37..ce13c88 100644 (file)
@@ -154,6 +154,7 @@ static int consumer_start( mlt_consumer this )
        {
                // Allocate a thread
                pthread_t *thread = calloc( 1, sizeof( pthread_t ) );
+               pthread_attr_t thread_attributes;
 
                // Get the width and height
                int width = mlt_properties_get_int( properties, "width" );
@@ -187,8 +188,12 @@ static int consumer_start( mlt_consumer this )
                // Set the running state
                mlt_properties_set_int( properties, "running", 1 );
 
+               // Inherit the scheduling priority
+               pthread_attr_init( &thread_attributes );
+               pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
+               
                // Create the thread
-               pthread_create( thread, NULL, consumer_thread, this );
+               pthread_create( thread, &thread_attributes, consumer_thread, this );
        }
        return 0;
 }
@@ -711,4 +716,3 @@ static void consumer_close( mlt_consumer this )
        // Free the memory
        free( this );
 }
-