On Wed, 30 Sep 2009, William Weston wrote:
And last but not least, I have attached a small patch to give me better debug
info on the call to mlockall() and the first call to pthread_create(), where
the MIDI thread is created. Could you apply the patch and send me the debug
output?
Oops... here's the patch for real this time.
Cheers,
--ww
--- phasex/src/phasex.c.orig 2009-09-29 14:09:57.000000000 -0700
+++ phasex/src/phasex.c 2009-09-30 14:28:00.000000000 -0700
@@ -384,9 +384,16 @@
char **envp = environ;
char *argvend = (char *)argv;
int argsize;
+ int saved_errno;
/* lock down memory (rt hates page faults) */
- mlockall (MCL_CURRENT | MCL_FUTURE);
+ if (mlockall (MCL_CURRENT | MCL_FUTURE) != 0) {
+ saved_errno = errno;
+ if (debug) {
+ fprintf (stderr, "Unable to unlock memory: errno=%d (%s)\n",
+ saved_errno, strerror (saved_errno));
+ }
+ }
/* get instance number */
phasex_instance = get_instance_num();
@@ -621,7 +628,18 @@
/* start midi thread */
init_rt_mutex (&midi_ready_mutex, 1);
if ((ret = pthread_create (&midi_thread_p, NULL, &midi_thread, NULL)) != 0) {
- phasex_shutdown ("Unable to start MIDI thread.\n");
+ saved_errno = errno;
+ if (debug) {
+ fprintf (stderr, "Unable to start MIDI thread: error %d (%s).\n errno=%d (%s)\n",
+ ret,
+ (ret == EAGAIN) ? "EAGAIN" :
+ (ret == EINVAL) ? "EINVAL" :
+ (ret == EPERM) ? "EPERM" : "",
+ saved_errno,
+ strerror (saved_errno));
+ phasex_shutdown ("Unrecoverable error. Shutting down.\n");
+ }
+ phasex_shutdown ("Unable to start MIDI thread. Shutting down.\n");
}
/* Build filter and envelope tables now that sample rate is known */
_______________________________________________
Linux-audio-user mailing list
Linux-audio-user@xxxxxxxxxxxxxxxxxxxx
http://lists.linuxaudio.org/mailman/listinfo/linux-audio-user