git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@943 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2006-03-27 20:14:34 +00:00
parent 322f5a150f
commit fd557f4ca3
2 changed files with 21 additions and 5 deletions

View File

@ -27,6 +27,9 @@
#include "jthread.h" #include "jthread.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
JThread::JThread() JThread::JThread()
{ {
@ -48,19 +51,25 @@ int JThread::Start()
{ {
if (!runningmutex.IsInitialized()) if (!runningmutex.IsInitialized())
{ {
if (runningmutex.Init() < 0) if (runningmutex.Init() < 0) {
printf("STUPID 1\n");
return ERR_JTHREAD_CANTINITMUTEX; return ERR_JTHREAD_CANTINITMUTEX;
} }
}
if (!continuemutex.IsInitialized()) if (!continuemutex.IsInitialized())
{ {
if (continuemutex.Init() < 0) if (continuemutex.Init() < 0) {
printf("STUPID 2\n");
return ERR_JTHREAD_CANTINITMUTEX; return ERR_JTHREAD_CANTINITMUTEX;
} }
}
if (!continuemutex2.IsInitialized()) if (!continuemutex2.IsInitialized())
{ {
if (continuemutex2.Init() < 0) if (continuemutex2.Init() < 0) {
printf("STUPID 3\n");
return ERR_JTHREAD_CANTINITMUTEX; return ERR_JTHREAD_CANTINITMUTEX;
} }
}
mutexinit = true; mutexinit = true;
} }
@ -68,6 +77,7 @@ int JThread::Start()
if (running) if (running)
{ {
runningmutex.Unlock(); runningmutex.Unlock();
printf("STUPID 4\n");
return ERR_JTHREAD_ALREADYRUNNING; return ERR_JTHREAD_ALREADYRUNNING;
} }
runningmutex.Unlock(); runningmutex.Unlock();
@ -77,6 +87,7 @@ int JThread::Start()
if (status != 0) if (status != 0)
{ {
continuemutex.Unlock(); continuemutex.Unlock();
printf("STUPID 5 %d (%s) (%s)\n", strerror(errno), strerror(status));
return ERR_JTHREAD_CANTSTARTTHREAD; return ERR_JTHREAD_CANTSTARTTHREAD;
} }

View File

@ -903,12 +903,17 @@ SWITCH_DECLARE(switch_status) switch_ivr_multi_threaded_bridge(switch_core_sessi
/* read from the channel while we wait if the audio is up on it */ /* read from the channel while we wait if the audio is up on it */
if (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) { if (switch_channel_test_flag(caller_channel, CF_ANSWERED) || switch_channel_test_flag(caller_channel, CF_EARLY_MEDIA)) {
if (switch_core_session_read_frame(session, &read_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) { if (switch_core_session_read_frame(session, &read_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) {
break; break;
} }
if (read_frame) {
memset(read_frame->data, 0, read_frame->datalen);
if (switch_core_session_write_frame(session, read_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) { if (switch_core_session_write_frame(session, read_frame, 1000, 0) != SWITCH_STATUS_SUCCESS) {
break; break;
} }
}
} else { } else {
switch_yield(1000); switch_yield(1000);
} }