Update of /cvsroot/audacity/lib-src/portaudio-v19/src/os/unix
In directory 
sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv27584/portaudio-v19/src/os/unix

Modified Files:
        pa_unix_hostapis.c pa_unix_util.c pa_unix_util.h 
Log Message:

Update portaudio to 2007-jun-01 snapshot


Index: pa_unix_util.h
===================================================================
RCS file: /cvsroot/audacity/lib-src/portaudio-v19/src/os/unix/pa_unix_util.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- pa_unix_util.h      23 Sep 2006 18:42:51 -0000      1.2
+++ pa_unix_util.h      3 Jun 2007 08:30:32 -0000       1.3
@@ -189,7 +189,8 @@
  * wait for ever, greater than 0 wait for the specified time.
  * @return: If timed out waiting on child, paTimedOut.
  */
-PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), 
void* threadArg, PaTime waitForChild );
+PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), 
void* threadArg, PaTime waitForChild,
+        int rtSched );
 
 /** Terminate thread.
  *

Index: pa_unix_util.c
===================================================================
RCS file: /cvsroot/audacity/lib-src/portaudio-v19/src/os/unix/pa_unix_util.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pa_unix_util.c      26 Mar 2007 00:45:13 -0000      1.4
+++ pa_unix_util.c      3 Jun 2007 08:30:32 -0000       1.5
@@ -208,23 +208,31 @@
     return paNoError;
 }
 
-#if 0
-PaError PaUnixThread_Initialize( PaUnixThread* self )
+static PaError BoostPriority( PaUnixThread* self )
 {
-    th->watchdogRunning = 0;
-    th->rtSched = 0;
-    th->callbackTime = 0;
-    th->callbackCpuTime = 0;
-    th->useWatchdog = 1;
-    th->throttledSleepTime = 0;
-    th->cpuLoadMeasurer = clm;
+    PaError result = paNoError;
+    struct sched_param spm = { 0 };
+    /* Priority should only matter between contending FIFO threads? */
+    spm.sched_priority = 1;
 
-    th->rtPrio = (sched_get_priority_max( SCHED_FIFO ) - 
sched_get_priority_min( SCHED_FIFO )) / 2
-            + sched_get_priority_min( SCHED_FIFO );
+    assert( self );
+
+    if( pthread_setschedparam( self->thread, SCHED_FIFO, &spm ) != 0 )
+    {
+        PA_UNLESS( errno == EPERM, paInternalError );  /* Lack permission to 
raise priority */
+        PA_DEBUG(( "Failed bumping priority\n" ));
+        result = 0;
+    }
+    else
+    {
+        result = 1; /* Success */
+    }
+error:
+    return result;
 }
-#endif
 
-PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), 
void* threadArg, PaTime waitForChild )
+PaError PaUnixThread_New( PaUnixThread* self, void* (*threadFunc)( void* ), 
void* threadArg, PaTime waitForChild,
+        int rtSched )
 {
     PaError result = paNoError;
     pthread_attr_t attr;
@@ -238,8 +246,10 @@
 
     /* Spawn thread */
 
-#if 0 && defined _POSIX_MEMLOCK && (_POSIX_MEMLOCK != -1)
-    if( th->rtSched )
+/* Temporarily disabled since we should test during configuration for presence 
of required mman.h header */
+#if 0
+#if defined _POSIX_MEMLOCK && (_POSIX_MEMLOCK != -1)
+    if( rtSched )
     {
         if( mlockall( MCL_CURRENT | MCL_FUTURE ) < 0 )
         {
@@ -252,6 +262,7 @@
             PA_DEBUG(( "%s: Successfully locked memory\n", __FUNCTION__ ));
     }
 #endif
+#endif
 
     PA_UNLESS( !pthread_attr_init( &attr ), paInternalError );
     /* Priority relative to other processes */
@@ -260,15 +271,15 @@
     PA_UNLESS( !pthread_create( &self->thread, &attr, threadFunc, threadArg ), 
paInternalError );
     started = 1;
 
-#if 0
-    if( th->rtSched )
+    if( rtSched )
     {
-        if( th->useWatchdog )
+#if 0
+        if( self->useWatchdog )
         {
             int err;
             struct sched_param wdSpm = { 0 };
             /* Launch watchdog, watchdog sets callback thread priority */
-            int prio = PA_MIN( th->rtPrio + 4, sched_get_priority_max( 
SCHED_FIFO ) );
+            int prio = PA_MIN( self->rtPrio + 4, sched_get_priority_max( 
SCHED_FIFO ) );
             wdSpm.sched_priority = prio;
 
             PA_UNLESS( !pthread_attr_init( &attr ), paInternalError );
@@ -276,7 +287,7 @@
             PA_UNLESS( !pthread_attr_setscope( &attr, PTHREAD_SCOPE_SYSTEM ), 
paInternalError );
             PA_UNLESS( !pthread_attr_setschedpolicy( &attr, SCHED_FIFO ), 
paInternalError );
             PA_UNLESS( !pthread_attr_setschedparam( &attr, &wdSpm ), 
paInternalError );
-            if( (err = pthread_create( &th->watchdogThread, &attr, 
&WatchdogFunc, th )) )
+            if( (err = pthread_create( &self->watchdogThread, &attr, 
&WatchdogFunc, self )) )
             {
                 PA_UNLESS( err == EPERM, paInternalError );
                 /* Permission error, go on without realtime privileges */
@@ -285,8 +296,8 @@
             else
             {
                 int policy;
-                th->watchdogRunning = 1;
-                PA_ENSURE_SYSTEM( pthread_getschedparam( th->watchdogThread, 
&policy, &wdSpm ), 0 );
+                self->watchdogRunning = 1;
+                PA_ENSURE_SYSTEM( pthread_getschedparam( self->watchdogThread, 
&policy, &wdSpm ), 0 );
                 /* Check if priority is right, policy could potentially differ 
from SCHED_FIFO (but that's alright) */
                 if( wdSpm.sched_priority != prio )
                 {
@@ -296,9 +307,15 @@
             }
         }
         else
-            PA_ENSURE( BoostPriority( th ) );
-    }
 #endif
+            PA_ENSURE( BoostPriority( self ) );
+
+        {
+            int policy;
+            struct sched_param spm;
+            pthread_getschedparam(self->thread, &policy, &spm);
+        }
+    }
     
     if( self->parentWaiting )
     {
@@ -387,12 +404,7 @@
     PA_DEBUG(( "%s: Joining thread %d\n", __FUNCTION__, self->thread ));
     PA_ENSURE_SYSTEM( pthread_join( self->thread, &pret ), 0 );
 
-#ifdef PTHREAD_CANCELED
     if( pret && PTHREAD_CANCELED != pret )
-#else
-    /* !wait means the thread may have been canceled */
-    if( pret && wait )
-#endif
     {
         if( exitResult )
         {
@@ -491,22 +503,8 @@
     return result;
 }
 
-#if 0
-/* Threading utility struct */
-typedef struct PaAlsaThreading
-{
-    pthread_t watchdogThread;
-    pthread_t callbackThread;
-    int watchdogRunning;
-    int rtSched;
-    int rtPrio;
-    int useWatchdog;
-    unsigned long throttledSleepTime;
-    volatile PaTime callbackTime;
-    volatile PaTime callbackCpuTime;
-    PaUtilCpuLoadMeasurer *cpuLoadMeasurer;
-} PaAlsaThreading;
 
+#if 0
 static void OnWatchdogExit( void *userData )
 {
     PaAlsaThreading *th = (PaAlsaThreading *) userData;
@@ -517,26 +515,6 @@
     PA_DEBUG(( "Watchdog exiting\n" ));
 }
 
-static PaError BoostPriority( PaAlsaThreading *th )
-{
-    PaError result = paNoError;
-    struct sched_param spm = { 0 };
-    spm.sched_priority = th->rtPrio;
-
-    assert( th );
-
-    if( pthread_setschedparam( th->callbackThread, SCHED_FIFO, &spm ) != 0 )
-    {
-        PA_UNLESS( errno == EPERM, paInternalError );  /* Lack permission to 
raise priority */
-        PA_DEBUG(( "Failed bumping priority\n" ));
-        result = 0;
-    }
-    else
-        result = 1; /* Success */
-error:
-    return result;
-}
-
 static void *WatchdogFunc( void *userData )
 {
     PaError result = paNoError, *pres = NULL;
@@ -666,7 +644,6 @@
     th->callbackTime = PaUtil_GetTime();
     th->callbackCpuTime = PaUtil_GetCpuLoad( th->cpuLoadMeasurer );
 }
-#endif
 
 /*
 static void *CanaryFunc( void *userData )
@@ -685,3 +662,4 @@
     pthread_exit( NULL );
 }
 */
+#endif



-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Audacity-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/audacity-cvs

Reply via email to