]> git.sesse.net Git - mlt/commitdiff
inherit scheduling priority on any created thread
authorddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 30 Mar 2004 16:34:32 +0000 (16:34 +0000)
committerddennedy <ddennedy@d19143bc-622f-0410-bfdd-b5b2a6649095>
Tue, 30 Mar 2004 16:34:32 +0000 (16:34 +0000)
git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@261 d19143bc-622f-0410-bfdd-b5b2a6649095

src/framework/mlt_consumer.c
src/modules/avformat/consumer_avformat.c
src/modules/dv/consumer_libdv.c
src/modules/sdl/consumer_sdl.c

index 9bccbed118f4ed3ca7a5c066a7b433bbf3821bb6..2fb7dd33c597f09f3cfbc6800d6f247ea38e8373 100644 (file)
@@ -315,6 +315,8 @@ static void *consumer_read_ahead_thread( void *arg )
 
 static void consumer_read_ahead_start( mlt_consumer this )
 {
+       pthread_attr_t thread_attributes;
+       
        // We're running now
        this->ahead = 1;
 
@@ -327,8 +329,12 @@ static void consumer_read_ahead_start( mlt_consumer this )
        // Create the condition
        pthread_cond_init( &this->cond, NULL );
 
+       // Inherit the scheduling priority
+       pthread_attr_init( &thread_attributes );
+       pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
+       
        // Create the read ahead 
-       pthread_create( &this->ahead_thread, NULL, consumer_read_ahead_thread, this );
+       pthread_create( &this->ahead_thread, &thread_attributes, consumer_read_ahead_thread, this );
 
 }
 
index 4b64d379d9eb095f0074bcce594830db400db883..ce13c8841aa674bd7073a1eebfadb26cf4307b84 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 );
 }
-
index af25795956394dc9ccb14b4eb5d62e5c9b92a0ff..d82d32b7c8e1b0a9fc6d776a233fe18298080b03 100644 (file)
@@ -98,6 +98,7 @@ static int consumer_start( mlt_consumer this )
        {
                // Allocate a thread
                pthread_t *thread = calloc( 1, sizeof( pthread_t ) );
+               pthread_attr_t thread_attributes;
 
                // Assign the thread to properties
                mlt_properties_set_data( properties, "thread", thread, sizeof( pthread_t ), free, NULL );
@@ -105,8 +106,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;
 }
@@ -425,4 +430,3 @@ static void consumer_close( mlt_consumer this )
        // Free the memory
        free( this );
 }
-
index d94022b2883cadc0da0ba43a8059375abde962e6..41eea141ed2208dc5e9f56c5f469740213605637 100644 (file)
@@ -166,8 +166,15 @@ int consumer_start( mlt_consumer parent )
 
        if ( !this->running )
        {
+               pthread_attr_t thread_attributes;
+               
                this->running = 1;
-               pthread_create( &this->thread, NULL, consumer_thread, this );
+               
+               // Inherit the scheduling priority
+               pthread_attr_init( &thread_attributes );
+               pthread_attr_setinheritsched( &thread_attributes, PTHREAD_INHERIT_SCHED );
+       
+               pthread_create( &this->thread, &thread_attributes, consumer_thread, this );
        }
 
        return 0;