Browse Source

TT#97500 set thread stack size

closes #1078

Change-Id: Iebe5effb917731c8ca553c9e599df613e763b255
pull/1093/head
Richard Fuchs 5 years ago
parent
commit
b260e145e7
6 changed files with 34 additions and 0 deletions
  1. +8
    -0
      daemon/aux.c
  2. +5
    -0
      daemon/rtpengine.pod
  3. +4
    -0
      lib/auxlib.c
  4. +1
    -0
      lib/auxlib.h
  5. +11
    -0
      recording-daemon/main.c
  6. +5
    -0
      recording-daemon/rtpengine-recording.pod

+ 8
- 0
daemon/aux.c View File

@ -9,6 +9,7 @@
#include <errno.h>
#include <unistd.h>
#include "log.h"
#include "main.h"
@ -221,6 +222,13 @@ static int thread_create(void *(*func)(void *), void *arg, int joinable, pthread
abort();
if (pthread_attr_setdetachstate(&att, joinable ? PTHREAD_CREATE_JOINABLE : PTHREAD_CREATE_DETACHED))
abort();
if (rtpe_config.common.thread_stack > 0) {
if (pthread_attr_setstacksize(&att, rtpe_config.common.thread_stack * 1024)) {
ilog(LOG_ERR, "Failed to set thread stack size to %llu",
(unsigned long long) rtpe_config.common.thread_stack * 1024);
abort();
}
}
ret = pthread_create(&thr, &att, func, arg);
pthread_attr_destroy(&att);
if (ret)


+ 5
- 0
daemon/rtpengine.pod View File

@ -288,6 +288,11 @@ decoding the media file, and another to schedule and send out RTP packets.
So for example, if this option is set to 4, in total 8 threads will be
launched.
=item B<--thread-stack=>I<INT>
Set the stack size of each thread to the value given in kB. Defaults to 2048
kB. Can be set to -1 to leave the default provided by the OS unchanged.
=item B<--sip-source>
The original B<rtpproxy> as well as older version of B<rtpengine> by default


+ 4
- 0
lib/auxlib.c View File

@ -153,6 +153,7 @@ void config_load(int *argc, char ***argv, GOptionEntry *app_entries, const char
{ "log-mark-suffix", 0, 0, G_OPTION_ARG_STRING, &rtpe_common_config_ptr->log_mark_suffix,"Suffix for sensitive log info", NULL },
{ "pidfile", 'p', 0, G_OPTION_ARG_FILENAME, &rtpe_common_config_ptr->pidfile, "Write PID to file", "FILE" },
{ "foreground", 'f', 0, G_OPTION_ARG_NONE, &rtpe_common_config_ptr->foreground, "Don't fork to background", NULL },
{ "thread-stack", 0,0, G_OPTION_ARG_INT, &rtpe_common_config_ptr->thread_stack, "Thread stack size in kB", "INT" },
{ NULL, }
};
@ -322,6 +323,9 @@ out:
max_log_line_length = 0;
}
if (rtpe_common_config_ptr->thread_stack == 0)
rtpe_common_config_ptr->thread_stack = 2048;
return;


+ 1
- 0
lib/auxlib.h View File

@ -24,6 +24,7 @@ struct rtpengine_common_config {
char *log_mark_suffix;
char *pidfile;
int foreground;
int thread_stack;
};
extern struct rtpengine_common_config *rtpe_common_config_ptr;


+ 11
- 0
recording-daemon/main.c View File

@ -93,6 +93,17 @@ static void setup(void) {
static void start_poller_thread(void) {
pthread_attr_t att;
if (pthread_attr_init(&att))
abort();
if (rtpe_common_config.thread_stack > 0) {
if (pthread_attr_setstacksize(&att, rtpe_common_config.thread_stack * 1024)) {
ilog(LOG_ERR, "Failed to set thread stack size to %llu",
(unsigned long long) rtpe_common_config.thread_stack * 1024);
abort();
}
}
pthread_t *thr = g_slice_alloc(sizeof(*thr));
int ret = pthread_create(thr, NULL, poller_thread,
GUINT_TO_POINTER(garbage_new_thread_num()));


+ 5
- 0
recording-daemon/rtpengine-recording.pod View File

@ -120,6 +120,11 @@ reside on a file system that supports the B<inotify> mechanism.
How many worker threads to launch. Defaults to B<8>.
=item B<--thread-stack=>I<INT>
Set the stack size of each thread to the value given in kB. Defaults to 2048
kB. Can be set to -1 to leave the default provided by the OS unchanged.
=item B<--output-storage=>B<file>|B<db>|B<both>
Where to store media files. By default, media files are written directly to the


Loading…
Cancel
Save