[asterisk-commits] jdixon: branch jdixon/chan_usbradio-1.4 r150888 - /team/jdixon/chan_usbradio-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Oct 17 22:58:22 CDT 2008
Author: jdixon
Date: Fri Oct 17 22:58:21 2008
New Revision: 150888
URL: http://svn.digium.com/view/asterisk?view=rev&rev=150888
Log:
Fix instabilities especially with uCLibC
Modified:
team/jdixon/chan_usbradio-1.4/main/pbx.c
team/jdixon/chan_usbradio-1.4/main/utils.c
Modified: team/jdixon/chan_usbradio-1.4/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/main/pbx.c?view=diff&rev=150888&r1=150887&r2=150888
==============================================================================
--- team/jdixon/chan_usbradio-1.4/main/pbx.c (original)
+++ team/jdixon/chan_usbradio-1.4/main/pbx.c Fri Oct 17 22:58:21 2008
@@ -2629,7 +2629,7 @@
enum ast_pbx_result ast_pbx_start(struct ast_channel *c)
{
pthread_t t;
- pthread_attr_t attr;
+ pthread_attr_t *attr;
if (!c) {
ast_log(LOG_WARNING, "Asked to start thread on NULL channel?\n");
@@ -2639,15 +2639,24 @@
if (increase_call_count(c))
return AST_PBX_CALL_LIMIT;
+ attr = malloc(sizeof(pthread_attr_t));
+ if (!attr)
+ {
+ ast_log(LOG_ERROR,"Cant malloc");
+ return AST_PBX_FAILED;
+ }
+
/* Start a new thread, and get something handling this channel. */
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (ast_pthread_create(&t, &attr, pbx_thread, c)) {
+ pthread_attr_init(attr);
+ pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED);
+ if (ast_pthread_create(&t, attr, pbx_thread, c)) {
ast_log(LOG_WARNING, "Failed to create new channel thread\n");
- pthread_attr_destroy(&attr);
+ pthread_attr_destroy(attr);
+ ast_free(attr);
return AST_PBX_FAILED;
}
- pthread_attr_destroy(&attr);
+ pthread_attr_destroy(attr);
+ ast_free(attr);
return AST_PBX_SUCCESS;
}
Modified: team/jdixon/chan_usbradio-1.4/main/utils.c
URL: http://svn.digium.com/view/asterisk/team/jdixon/chan_usbradio-1.4/main/utils.c?view=diff&rev=150888&r1=150887&r2=150888
==============================================================================
--- team/jdixon/chan_usbradio-1.4/main/utils.c (original)
+++ team/jdixon/chan_usbradio-1.4/main/utils.c Fri Oct 17 22:58:21 2008
@@ -925,9 +925,10 @@
#if !defined(LOW_MEMORY)
struct thr_arg *a;
#endif
+char __mystorage[sizeof(*attr)];
if (!attr) {
- attr = alloca(sizeof(*attr));
+ attr = (pthread_attr_t *)__mystorage;
pthread_attr_init(attr);
}
More information about the asterisk-commits
mailing list