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

@ -266,9 +266,9 @@ typedef struct _st_netfd {
* Current vp, thread, and event system
*/
extern _st_vp_t _st_this_vp;
extern _st_thread_t *_st_this_thread;
extern _st_eventsys_t *_st_eventsys;
extern __thread _st_vp_t _st_this_vp;
extern __thread _st_thread_t *_st_this_thread;
extern __thread _st_eventsys_t *_st_eventsys;
#define _ST_CURRENT_THREAD() (_st_this_thread)
#define _ST_SET_CURRENT_THREAD(_thread) (_st_this_thread = (_thread))