[PD-cvs] pd/src d_soundfile.c,1.1.1.2.2.10,1.1.1.2.2.11
Tim Blechmann
timblech at users.sourceforge.net
Thu Jun 17 18:42:35 CEST 2004
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1190
Modified Files:
Tag: devel_0_37
d_soundfile.c
Log Message:
added debug messages (switched on by default)
Index: d_soundfile.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v
retrieving revision 1.1.1.2.2.10
retrieving revision 1.1.1.2.2.11
diff -C2 -d -r1.1.1.2.2.10 -r1.1.1.2.2.11
*** d_soundfile.c 17 Jun 2004 07:56:57 -0000 1.1.1.2.2.10
--- d_soundfile.c 17 Jun 2004 16:42:33 -0000 1.1.1.2.2.11
***************
*** 916,919 ****
--- 916,925 ----
static t_sfqueue * soundfiler_queue;
+ #define DEBUG
+
+ #ifdef DEBUG
+ #define SFDEBUG
+ #endif
+
/* we fill the queue */
void soundfiler_queue_add(void (* process) (t_soundfiler *,t_symbol *,
***************
*** 923,927 ****
/* preparing argument vector */
t_atom * largv = copybytes (argv, argc * sizeof(t_atom));
! static int i;
// make sure that the argument vector doesn't get lost
--- 929,937 ----
/* preparing argument vector */
t_atom * largv = copybytes (argv, argc * sizeof(t_atom));
! int i;
!
! #ifdef SFDEBUG
! post("adding process to queue");
! #endif
// make sure that the argument vector doesn't get lost
***************
*** 952,955 ****
--- 962,969 ----
pthread_mutex_unlock(&(last_entry->mutex));
+ #ifdef SFDEBUG
+ post("\tentry has been prepared");
+ #endif
+
/* inform the queue and the last element */
pthread_mutex_lock(&(soundfiler_queue->mutex));
***************
*** 967,974 ****
soundfiler_queue->end=last_entry;
}
if ( soundfiler_queue->begin == soundfiler_queue->end )
{
- /* we should start the helper thread */
#ifdef DEBUG
post("signaling");
--- 981,991 ----
soundfiler_queue->end=last_entry;
}
+ #ifdef SFDEBUG
+ post("\t\tnew begin: %x",soundfiler_queue->begin);
+ post("\t\tnew end: %x",soundfiler_queue->end);
+ #endif
if ( soundfiler_queue->begin == soundfiler_queue->end )
{
#ifdef DEBUG
post("signaling");
***************
*** 991,999 ****
void soundfiler_thread(void)
{
! struct sched_param sf_param;
! sf_param.sched_priority=sched_get_priority_min(SCHED_FIFO)+1;
!
#ifdef __linux__
- /* this doesn't work on windows .. i'll have to check it for osx */
if (sched_setscheduler(0,SCHED_FIFO,&sf_param) != -1)
fprintf(stderr, "priority %d scheduling for soundfiler.\n",
--- 1008,1014 ----
void soundfiler_thread(void)
{
!
! /*
#ifdef __linux__
if (sched_setscheduler(0,SCHED_FIFO,&sf_param) != -1)
fprintf(stderr, "priority %d scheduling for soundfiler.\n",
***************
*** 1003,1009 ****
fprintf(stderr, "priority %d scheduling for soundfiler.\n",
sf_param.sched_priority);
! #endif /* __linux__ */
!
!
while (1)
--- 1018,1023 ----
fprintf(stderr, "priority %d scheduling for soundfiler.\n",
sf_param.sched_priority);
! #endif
! */
while (1)
***************
*** 1024,1027 ****
--- 1038,1045 ----
/* locking process */
pthread_mutex_lock(&(soundfiler_queue->begin->mutex));
+
+ #ifdef SFDEBUG
+ post("working on process: %x",soundfiler_queue->begin);
+ #endif
/* create a copy that we can work on */
***************
*** 1031,1034 ****
--- 1049,1057 ----
me->argv = copybytes (soundfiler_queue->begin->argv,
soundfiler_queue->begin->argc * sizeof(t_atom));
+ #ifdef SFDEBUG
+ post("\t\told begin: %x", soundfiler_queue->begin);
+ post("\t\told next: %x", soundfiler_queue->begin->next);
+ post("\t\told end: %x", soundfiler_queue->end);
+ #endif
static int i;
***************
*** 1069,1072 ****
--- 1092,1099 ----
pthread_mutex_lock(&(soundfiler_queue->mutex));
pthread_mutex_lock(&(soundfiler_queue->begin->mutex));
+
+ #ifdef SFDEBUG
+ post("\tfreeing allocated memory");
+ #endif
/* freeing the memory we allocated */
***************
*** 1113,1118 ****
--- 1140,1154 ----
/* the process struct */
freebytes(me,sizeof(t_sfprocess));
+ #ifdef SFDEBUG
+ post("\t\tnew begin: %x", soundfiler_queue->begin);
+ post("\t\tnew end: %x", soundfiler_queue->end);
+ #endif
+
};
soundfiler_queue->end=NULL;
+ #ifdef SFDEBUG
+ post("\tbegin: %x", soundfiler_queue->begin);
+ post("\tend: %x", soundfiler_queue->end);
+ #endif
}
***************
*** 1131,1139 ****
pthread_mutex_unlock(&(soundfiler_queue->mutex));
! if (pthread_create(&sf_thread_id, NULL,
! (void *) soundfiler_thread,NULL) !=0)
! error("Couldn't create soundfiler thread");
else
! post("global soundfiler thread launched");
}
--- 1167,1188 ----
pthread_mutex_unlock(&(soundfiler_queue->mutex));
! pthread_attr_t sf_attr;
! pthread_attr_init(&sf_attr);
! struct sched_param sf_param;
!
! sf_param.sched_priority=sched_get_priority_min(SCHED_FIFO);
!
! pthread_attr_setdetachstate(&sf_attr,PTHREAD_CREATE_DETACHED);
! pthread_attr_setschedparam(&sf_attr,&sf_param);
! //pthread_attr_setschedpolicy(&sf_attr,SCHED_RR);
! pthread_attr_setinheritsched(&sf_attr,PTHREAD_EXPLICIT_SCHED);
!
! int status = pthread_create(&sf_thread_id, &sf_attr,
! (void *) soundfiler_thread,NULL);
! if ( status !=0)
! error("Couldn't create soundfiler thread: %d",status);
else
! post("global soundfiler thread launched, priority: %d",
! sf_param.sched_priority);
}
More information about the Pd-cvs
mailing list