Re: Asterisk Hi-Load
Добавлено: 03 фев 2014, 13:57
Да, таймеры я и посмотрел.
Без rtp всякие разрыватели rtcp timeout не работают?
Без rtp всякие разрыватели rtcp timeout не работают?
Код: Выделить всё
# cat /proc/sys/kernel/threads-max
32339
Код: Выделить всё
/* Start a new thread, and get something handling this channel. */
if (ast_pthread_create_detached(&t, NULL, pbx_thread, c)) {
ast_log(LOG_WARNING, "Failed to create new channel thread\n");
decrease_call_count();
return AST_PBX_FAILED;
}
Код: Выделить всё
int ast_pthread_create_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *),
void *data, size_t stacksize, const char *file, const char *caller,
int line, const char *start_fn)
{
#if !defined(LOW_MEMORY)
struct thr_arg *a;
#endif
if (!attr) {
attr = ast_alloca(sizeof(*attr));
pthread_attr_init(attr);
}
#ifdef __linux__
/* On Linux, pthread_attr_init() defaults to PTHREAD_EXPLICIT_SCHED,
which is kind of useless. Change this here to
PTHREAD_INHERIT_SCHED; that way the -p option to set realtime
priority will propagate down to new threads by default.
This does mean that callers cannot set a different priority using
PTHREAD_EXPLICIT_SCHED in the attr argument; instead they must set
the priority afterwards with pthread_setschedparam(). */
if ((errno = pthread_attr_setinheritsched(attr, PTHREAD_INHERIT_SCHED)))
ast_log(LOG_WARNING, "pthread_attr_setinheritsched: %s\n", strerror(errno));
#endif
if (!stacksize)
stacksize = AST_STACKSIZE;
if ((errno = pthread_attr_setstacksize(attr, stacksize ? stacksize : AST_STACKSIZE)))
ast_log(LOG_WARNING, "pthread_attr_setstacksize: %s\n", strerror(errno));
#if !defined(LOW_MEMORY)
if ((a = ast_malloc(sizeof(*a)))) {
a->start_routine = start_routine;
a->data = data;
start_routine = dummy_start;
if (ast_asprintf(&a->name, "%-20s started at [%5d] %s %s()",
start_fn, line, file, caller) < 0) {
a->name = NULL;
}
data = a;
}
#endif /* !LOW_MEMORY */
return pthread_create(thread, attr, start_routine, data); /* We're in ast_pthread_create, so it's okay */
}
int ast_pthread_create_detached_stack(pthread_t *thread, pthread_attr_t *attr, void *(*start_routine)(void *),
void *data, size_t stacksize, const char *file, const char *caller,
int line, const char *start_fn)
{
unsigned char attr_destroy = 0;
int res;
if (!attr) {
attr = ast_alloca(sizeof(*attr));
pthread_attr_init(attr);
attr_destroy = 1;
}
if ((errno = pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED)))
ast_log(LOG_WARNING, "pthread_attr_setdetachstate: %s\n", strerror(errno));
res = ast_pthread_create_stack(thread, attr, start_routine, data,
stacksize, file, caller, line, start_fn);
if (attr_destroy)
pthread_attr_destroy(attr);
return res;
}