1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

ST: Support thread-local for multiple threads.

1. All statick and global variables is thread-local.
2. Call st_init() to init st for each thread.
3. Notice that ST is isolate for threads.
This commit is contained in:
winlin 2021-04-05 12:37:53 +08:00
parent d117145b95
commit 339d3b31cc
8 changed files with 61 additions and 54 deletions

View file

@ -52,9 +52,9 @@
/* How much space to leave between the stacks, at each end */
#define REDZONE _ST_PAGE_SIZE
_st_clist_t _st_free_stacks = ST_INIT_STATIC_CLIST(&_st_free_stacks);
int _st_num_free_stacks = 0;
int _st_randomize_stacks = 0;
__thread _st_clist_t _st_free_stacks;
__thread int _st_num_free_stacks = 0;
__thread int _st_randomize_stacks = 0;
static char *_st_new_stk_segment(int size);