*/
#include <asterisk/lock.h>
+#include <asterisk/utils.h>
#include <asterisk/file.h>
#include <asterisk/logger.h>
#include <asterisk/channel.h>
arg = (void *) strdup(fname);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&dialer_thread,&attr,qcall_do,arg) == -1)
+ if (ast_pthread_create(&dialer_thread,&attr,qcall_do,arg) == -1)
{
perror("qcall: Cannot create thread");
continue;
{
snprintf(qdir, sizeof(qdir), "%s/%s", ast_config_AST_SPOOL_DIR, "qcall");
mkdir(qdir,0760);
- pthread_create(&qcall_thread,NULL,qcall,NULL);
+ ast_pthread_create(&qcall_thread,NULL,qcall,NULL);
return 0;
}
enum {DC_INDETERMINATE, DC_REQ_FLUSH, DC_ERROR, DC_COMPLETE};
enum {SOURCE_RPT, SOURCE_LNK, SOURCE_RMT};
+#include <asterisk/utils.h>
#include <asterisk/lock.h>
#include <asterisk/file.h>
#include <asterisk/logger.h>
ast_mutex_unlock(&myrpt->lock);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
+ ast_pthread_create(&tele->threadid,&attr,rpt_tele_thread,(void *) tele);
return;
}
ast_mutex_unlock(&myrpt->lock);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *) myrpt);
+ ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *) myrpt);
return DC_COMPLETE;
}
myrpt->exten[myrpt->cidx] = 0;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *)myrpt);
+ ast_pthread_create(&myrpt->rpt_call_thread,&attr,rpt_call,(void *)myrpt);
continue;
}
}
ast_log(LOG_WARNING,"Did not specify ident for node %s\n",rpt_vars[i].name);
pthread_exit(NULL);
}
- pthread_create(&rpt_vars[i].rpt_thread,NULL,rpt,(void *) &rpt_vars[i]);
+ ast_pthread_create(&rpt_vars[i].rpt_thread,NULL,rpt,(void *) &rpt_vars[i]);
}
/* wait for first one to die (should be never) */
pthread_join(rpt_vars[0].rpt_thread,NULL);
int load_module(void)
{
- pthread_create(&rpt_master_thread,NULL,rpt_master,NULL);
+ ast_pthread_create(&rpt_master_thread,NULL,rpt_master,NULL);
return ast_register_application(app, rpt_exec, synopsis, descrip);
}
flags = fcntl(consoles[x].p[1], F_GETFL);
fcntl(consoles[x].p[1], F_SETFL, flags | O_NONBLOCK);
consoles[x].fd = s;
- if (pthread_create(&consoles[x].t, &attr, netconsole, &consoles[x])) {
+ if (ast_pthread_create(&consoles[x].t, &attr, netconsole, &consoles[x])) {
ast_log(LOG_ERROR, "Unable to spawn thread to handle connection: %s\n", strerror(errno));
consoles[x].fd = -1;
fdprint(s, "Server failed to spawn thread\n");
return -1;
}
ast_register_verbose(network_verboser);
- pthread_create(<hread, NULL, listener, NULL);
+ ast_pthread_create(<hread, NULL, listener, NULL);
return 0;
}
#include <asterisk/linkedlists.h>
#include <asterisk/indications.h>
#include <asterisk/lock.h>
+#include <asterisk/utils.h>
#define MAX_AUTOMONS 256
aslist = as;
res = 0;
if (needstart) {
- if (pthread_create(&asthread, NULL, autoservice_run, NULL)) {
+ if (ast_pthread_create(&asthread, NULL, autoservice_run, NULL)) {
ast_log(LOG_WARNING, "Unable to create autoservice thread :(\n");
free(aslist);
aslist = NULL;
#include <asterisk/pbx.h>
#include <asterisk/config.h>
#include <asterisk/cli.h>
+#include <asterisk/utils.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
}
for (x=0;x<sizeof(myclis)/sizeof(struct ast_cli_entry); x++)
ast_cli_register(myclis + x);
- pthread_create(&sthread, NULL, sound_thread, NULL);
+ ast_pthread_create(&sthread, NULL, sound_thread, NULL);
#ifdef ALSA_MONITOR
if (alsa_monitor_start()) {
ast_log(LOG_ERROR, "Problem starting Monitoring\n");
pthread_kill(monitor_thread, SIGURG);
} else {
/* Start a new monitor */
- if (pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
static int start_network_thread(void)
{
- return pthread_create(&netthreadid, NULL, network_thread, NULL);
+ return ast_pthread_create(&netthreadid, NULL, network_thread, NULL);
}
static struct iax_context *build_context(char *context)
strncpy(dpr->callednum, callednum, sizeof(dpr->callednum) - 1);
if (callerid)
dpr->callerid = strdup(callerid);
- if (pthread_create(&newthread, NULL, dp_lookup_thread, dpr)) {
+ if (ast_pthread_create(&newthread, NULL, dp_lookup_thread, dpr)) {
ast_log(LOG_WARNING, "Unable to start lookup thread!\n");
}
} else
memset(d, 0, sizeof(*d));
d->chan1 = chan1m;
d->chan2 = chan2m;
- if (!pthread_create(&th, NULL, iax_park_thread, d))
+ if (!ast_pthread_create(&th, NULL, iax_park_thread, d))
return 0;
free(d);
}
static int start_network_thread(void)
{
- return pthread_create(&netthreadid, NULL, network_thread, NULL);
+ return ast_pthread_create(&netthreadid, NULL, network_thread, NULL);
}
static struct iax2_context *build_context(char *context)
}
c = mgcp_new(sub, AST_STATE_DOWN);
if (c) {
- if (pthread_create(&t, &attr, mgcp_ss, c)) {
+ if (ast_pthread_create(&t, &attr, mgcp_ss, c)) {
ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno));
ast_hangup(c);
}
pthread_kill(monitor_thread, SIGURG);
} else {
/* Start a new monitor */
- if (pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
#include <asterisk/pbx.h>
#include <asterisk/options.h>
#include <asterisk/vmodem.h>
+#include <asterisk/utils.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <errno.h>
pthread_join(monitor_thread, NULL);
}
/* Start a new monitor */
- if (pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
#include <asterisk/pbx.h>
#include <asterisk/config.h>
#include <asterisk/cli.h>
+#include <asterisk/utils.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
}
ast_destroy(cfg);
}
- pthread_create(&sthread, NULL, sound_thread, NULL);
+ ast_pthread_create(&sthread, NULL, sound_thread, NULL);
return 0;
}
#endif
}
/* Start a new monitor */
- if (pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
copy_request(&d->req, req);
d->chan1 = chan1m;
d->chan2 = chan2m;
- if (!pthread_create(&th, NULL, sip_park_thread, d))
+ if (!ast_pthread_create(&th, NULL, sip_park_thread, d))
return 0;
free(d);
}
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
/* Start a new monitor */
- if (pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
c = skinny_new(sub, AST_STATE_DOWN);
if(c) {
/* start switch */
- if (pthread_create(&t, NULL, skinny_ss, c)) {
+ if (ast_pthread_create(&t, NULL, skinny_ss, c)) {
ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno));
ast_hangup(c);
}
sessions = s;
ast_mutex_unlock(&sessionlock);
- if (pthread_create(&tcp_thread, NULL, skinny_session, s)) {
+ if (ast_pthread_create(&tcp_thread, NULL, skinny_session, s)) {
destroy_session(s);
}
}
pthread_kill(monitor_thread, SIGURG);
} else {
/* Start a new monitor */
- if (pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
ast_verbose(VERBOSE_PREFIX_2 "Skinny listening on %s:%d\n",
ast_inet_ntoa(iabuf, sizeof(iabuf), bindaddr.sin_addr), ntohs(bindaddr.sin_port));
- pthread_create(&accept_t,NULL, accept_thread, NULL);
+ ast_pthread_create(&accept_t,NULL, accept_thread, NULL);
}
}
ast_mutex_unlock(&netlock);
#include <asterisk/config.h>
#include <asterisk/logger.h>
#include <asterisk/module.h>
+#include <asterisk/utils.h>
#include <asterisk/pbx.h>
#include <asterisk/options.h>
#include <sys/socket.h>
pthread_kill(monitor_thread, SIGURG);
} else {
/* Start a new monitor */
- if (pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
#include <asterisk/module.h>
#include <asterisk/pbx.h>
#include <asterisk/options.h>
+#include <asterisk/utils.h>
#include <sys/socket.h>
#include <sys/time.h>
#include <errno.h>
vpb_put_event(&e);
} else {
/* Start a new monitor */
- int pid = pthread_create(&monitor_thread, NULL, do_monitor, NULL);
+ int pid = ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL);
if (option_verbose > 3)
ast_verbose(VERBOSE_PREFIX_4 "Created new monitor thread %d\n",pid);
if (pid < 0) {
}
if (!p->readthread){
- pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
+ ast_pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
}
tmp = ast_mutex_unlock(&p->lock);
if( !p->readthread ){
// res = ast_mutex_unlock(&p->lock);
// ast_verbose("%s: unLOCKING in answer [%d]\n", p->dev,res);
- pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
+ ast_pthread_create(&p->readthread, NULL, do_chanreads, (void *)p);
} else {
if(option_verbose>3)
ast_verbose(VERBOSE_PREFIX_4 "%s: Record thread already running!!\n",p->dev);
if (res)
ast_log(LOG_WARNING, "Unable to start dial recall tone on channel %d\n", p->channel);
p->owner = chan;
- if (chan && pthread_create(&threadid, &attr, ss_thread, chan)) {
+ if (chan && ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch on channel %d\n", p->channel);
res = tone_zone_play_tone(p->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
zt_enable_ec(p);
res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_DIALTONE);
if (res < 0)
ast_log(LOG_WARNING, "Unable to play dialtone on channel %d\n", i->channel);
- if (pthread_create(&threadid, &attr, ss_thread, chan)) {
+ if (ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
if (res < 0)
case SIG_SF:
/* Check for callerid, digits, etc */
chan = zt_new(i, AST_STATE_RING, 0, SUB_REAL, 0, 0);
- if (chan && pthread_create(&threadid, &attr, ss_thread, chan)) {
+ if (chan && ast_pthread_create(&threadid, &attr, ss_thread, chan)) {
ast_log(LOG_WARNING, "Unable to start simple switch thread on channel %d\n", i->channel);
res = tone_zone_play_tone(i->subs[SUB_REAL].zfd, ZT_TONE_CONGESTION);
if (res < 0)
#endif
} else {
/* Start a new monitor */
- if (pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
idle = zt_request("Zap", AST_FORMAT_ULAW, idlen);
if (idle) {
pri->pvts[nextidle]->isidlecall = 1;
- if (pthread_create(&p, NULL, do_idle_thread, idle)) {
+ if (ast_pthread_create(&p, NULL, do_idle_thread, idle)) {
ast_log(LOG_WARNING, "Unable to start new thread for idle channel '%s'\n", idle->name);
zt_hangup(idle);
}
pbx_builtin_setvar_helper(c, "CALLINGSUBADDR", e->ring.callingsubaddr);
}
ast_mutex_lock(&pri->lock);
- if (c && !pthread_create(&threadid, &attr, ss_thread, c)) {
+ if (c && !ast_pthread_create(&threadid, &attr, ss_thread, c)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Accepting overlap call from '%s' to '%s' on channel %d/%d, span %d\n",
e->ring.callingnum, !ast_strlen_zero(pri->pvts[chanpos]->exten) ? pri->pvts[chanpos]->exten : "<unspecified>",
/* Assume primary is the one we use */
pri->pri = pri->dchans[0];
pri->resetpos = -1;
- if (pthread_create(&pri->master, NULL, pri_dchannel, pri)) {
+ if (ast_pthread_create(&pri->master, NULL, pri_dchannel, pri)) {
for (i=0;i<NUM_DCHANS;i++) {
if (!pri->dchannels[i])
break;
struct agi_command *next;
} agi_command;
-
+int agi_register(agi_command *cmd);
+void agi_unregister(agi_command *cmd);
#if defined(__cplusplus) || defined(c_plusplus)
}
#define AST_MUTEX_INITIALIZER __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__
#define gethostbyname __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__
+#define pthread_create __use_ast_pthread_create_instead__
#endif
#ifndef _ASTERISK_UTIL_H
#define _ASTERISK_UTIL_H
+#include <netinet/in.h>
#include <netdb.h>
+#include <pthread.h>
static inline int ast_strlen_zero(const char *s)
{
#endif
#define inet_ntoa __dont__use__inet_ntoa__use__ast_inet_ntoa__instead__
+#ifdef LINUX
+#define ast_pthread_create pthread_create
+#else
+/* Linux threads have a default 2MB stack size. */
+#ifndef PTHREAD_ATTR_STACKSIZE
+#define PTHREAD_ATTR_STACKSIZE 2097152
+#endif /* PTHREAD_ATTR_STACKSIZE */
+extern int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data);
+#endif /* LINUX */
+
#endif
fast->priority = pi;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&th, &attr, fast_originate, fast))
+ if (ast_pthread_create(&th, &attr, fast_originate, fast))
{
res = -1;
}
s->next = sessions;
sessions = s;
ast_mutex_unlock(&sessionlock);
- if (pthread_create(&t, &attr, session_do, s))
+ if (ast_pthread_create(&t, &attr, session_do, s))
destroy_session(s);
}
pthread_attr_destroy(&attr);
}
if (option_verbose)
ast_verbose("Asterisk Management interface listening on port %d\n", portno);
- pthread_create(&t, NULL, accept_thread, NULL);
+ ast_pthread_create(&t, NULL, accept_thread, NULL);
}
return 0;
}
/* Start a new thread, and get something handling this channel. */
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&t, &attr, pbx_thread, c)) {
+ if (ast_pthread_create(&t, &attr, pbx_thread, c)) {
ast_log(LOG_WARNING, "Failed to create new channel thread\n");
return -1;
}
}
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&as->p, &attr, async_wait, as)) {
+ if (ast_pthread_create(&as->p, &attr, async_wait, as)) {
ast_log(LOG_WARNING, "Failed to start async wait\n");
free(as);
ast_hangup(chan);
} else {
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&tmp->t, &attr, ast_pbx_run_app, tmp)) {
+ if (ast_pthread_create(&tmp->t, &attr, ast_pbx_run_app, tmp)) {
ast_log(LOG_WARNING, "Unable to spawn execute thread on %s: %s\n", chan->name, strerror(errno));
free(tmp);
ast_hangup(chan);
/* Start a new thread, and get something handling this channel. */
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&as->p, &attr, async_wait, as)) {
+ if (ast_pthread_create(&as->p, &attr, async_wait, as)) {
ast_log(LOG_WARNING, "Failed to start async wait\n");
free(as);
ast_hangup(chan);
#include <asterisk/logger.h>
#include <asterisk/options.h>
#include <asterisk/cli.h>
+#include <asterisk/utils.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
gtk_container_add(GTK_CONTAINER(window), hbox);
gtk_window_set_title(GTK_WINDOW(window), "Asterisk Console");
gtk_widget_grab_focus(cli);
- pthread_create(&console_thread, NULL, consolethread, NULL);
+ ast_pthread_create(&console_thread, NULL, consolethread, NULL);
/* XXX Okay, seriously fix me! XXX */
usleep(100000);
ast_register_verbose(verboser);
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&t,&attr,attempt_thread, o) == -1) {
+ if (ast_pthread_create(&t,&attr,attempt_thread, o) == -1) {
ast_log(LOG_WARNING, "Unable to create thread :(\n");
free(o);
}
}
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (pthread_create(&thread,&attr,scan_thread, NULL) == -1) {
+ if (ast_pthread_create(&thread,&attr,scan_thread, NULL) == -1) {
ast_log(LOG_WARNING, "Unable to create thread :(\n");
return -1;
}
#include <asterisk/module.h>
#include <asterisk/translate.h>
#include <asterisk/options.h>
+#include <asterisk/utils.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
/* if & then string is complete */
if(buf[x]=='&'){
if(NULL!=(pass=(void *)strdup(sendbuf))){
- pthread_create(&dialstring_thread, NULL, dialstring, pass);
+ ast_pthread_create(&dialstring_thread, NULL, dialstring, pass);
sendbufptr=sendbuf;
memset(sendbuf, 0, 257);
}
struct alarm_data *data = (struct alarm_data *) pass;
sleep(data->snooze_len);
- pthread_create(&dialstring_thread, NULL, dialstring, data->dialstr);
+ ast_pthread_create(&dialstring_thread, NULL, dialstring, data->dialstr);
/* dialstring will free data->dialstr */
free(pass);
pthread_exit(NULL);
pthread_exit(NULL);
}
pass->snooze_len=snooze_len;
- pthread_create(&snooze_alarm_thread,NULL,snooze_alarm,pass);
+ ast_pthread_create(&snooze_alarm_thread,NULL,snooze_alarm,pass);
}
static void *dialstring(void *string)
return 0;
}
}
- pthread_create(&autodialer_thread, NULL, autodial, NULL);
+ ast_pthread_create(&autodialer_thread, NULL, autodial, NULL);
return 0;
}
return 0;
}
-static int agi_register(agi_command *agi)
+int agi_register(agi_command *agi)
{
int x;
for (x=0;x<MAX_COMMANDS - 1;x++) {
return -1;
}
-static void agi_unregister(agi_command *agi)
+void agi_unregister(agi_command *agi)
{
int x;
for (x=0;x<MAX_COMMANDS - 1;x++) {
}
}
ast_add_extension2(con, 1, ast_parking_ext(), 1, NULL, parkcall, strdup(""),free, registrar);
- pthread_create(&parking_thread, NULL, do_parking_thread, NULL);
+ ast_pthread_create(&parking_thread, NULL, do_parking_thread, NULL);
res = ast_register_application(parkedcall, park_exec, synopsis, descrip);
if (!res)
res = ast_register_application(parkcall, park_call_exec, synopsis2, descrip2);
#else
moh->pseudofd = -1;
#endif
- if (pthread_create(&moh->thread, NULL, monmp3thread, moh)) {
+ if (ast_pthread_create(&moh->thread, NULL, monmp3thread, moh)) {
ast_log(LOG_WARNING, "Unable to create moh...\n");
if (moh->pseudofd > -1)
close(moh->pseudofd);
#include <ctype.h>
#include <string.h>
#include <unistd.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <asterisk/lock.h>
#include <asterisk/utils.h>
+#include <asterisk/logger.h>
static char base64[64];
static char b2a[256];
lock_count += 1;
ast_mutex_lock(&test_lock);
lock_count += 1;
- pthread_create(&test_thread, NULL, test_thread_body, NULL);
+ ast_pthread_create(&test_thread, NULL, test_thread_body, NULL);
usleep(100);
if (lock_count != 2)
test_errors++;
base64_init();
return 0;
}
+
+
+#ifndef LINUX
+#undef pthread_create /* For ast_pthread_create function only */
+int ast_pthread_create(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *), void *data)
+{
+ pthread_attr_t lattr;
+ if (!attr) {
+ pthread_attr_init(&lattr);
+ attr = &lattr;
+ }
+ errno = pthread_attr_setstacksize(attr, PTHREAD_ATTR_STACKSIZE);
+ if (errno)
+ ast_log(LOG_WARNING, "pthread_attr_setstacksize returned non-zero: %s\n", strerror(errno));
+ return pthread_create(thread, attr, start_routine, data); /* We're in ast_pthread_create, so it's okay */
+}
+#endif /* ! LINUX */