mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
ST: Support st_destroy to free resources for asan.
This commit is contained in:
parent
6eb10afca2
commit
6fa17aa3f8
5 changed files with 39 additions and 4 deletions
1
trunk/3rdparty/st-srs/README.md
vendored
1
trunk/3rdparty/st-srs/README.md
vendored
|
@ -118,6 +118,7 @@ The branch [srs](https://github.com/ossrs/state-threads/tree/srs) was patched an
|
|||
- [x] Define and use a new jmpbuf, because the structure is different.
|
||||
- [x] Check capability for backtrack.
|
||||
- [x] Support set specifics for any thread.
|
||||
- [x] Support st_destroy to free resources for asan.
|
||||
- [ ] System: Support sendmmsg for UDP, [#12](https://github.com/ossrs/state-threads/issues/12).
|
||||
|
||||
## GDB Tools
|
||||
|
|
1
trunk/3rdparty/st-srs/common.h
vendored
1
trunk/3rdparty/st-srs/common.h
vendored
|
@ -226,6 +226,7 @@ typedef struct _st_eventsys_ops {
|
|||
int (*fd_new)(int); /* New descriptor allocated */
|
||||
int (*fd_close)(int); /* Descriptor closed */
|
||||
int (*fd_getlimit)(void); /* Descriptor hard limit */
|
||||
void (*destroy)(void); /* Destroy the event object */
|
||||
} _st_eventsys_t;
|
||||
|
||||
|
||||
|
|
31
trunk/3rdparty/st-srs/event.c
vendored
31
trunk/3rdparty/st-srs/event.c
vendored
|
@ -430,6 +430,11 @@ ST_HIDDEN int _st_select_fd_getlimit(void)
|
|||
return FD_SETSIZE;
|
||||
}
|
||||
|
||||
ST_HIDDEN void _st_select_destroy(void)
|
||||
{
|
||||
/* TODO: FIXME: Implements it */
|
||||
}
|
||||
|
||||
static _st_eventsys_t _st_select_eventsys = {
|
||||
"select",
|
||||
ST_EVENTSYS_SELECT,
|
||||
|
@ -439,7 +444,8 @@ static _st_eventsys_t _st_select_eventsys = {
|
|||
_st_select_pollset_del,
|
||||
_st_select_fd_new,
|
||||
_st_select_fd_close,
|
||||
_st_select_fd_getlimit
|
||||
_st_select_fd_getlimit,
|
||||
_st_select_destroy
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -838,6 +844,11 @@ ST_HIDDEN int _st_kq_fd_getlimit(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
ST_HIDDEN void _st_kq_destroy(void)
|
||||
{
|
||||
/* TODO: FIXME: Implements it */
|
||||
}
|
||||
|
||||
static _st_eventsys_t _st_kq_eventsys = {
|
||||
"kqueue",
|
||||
ST_EVENTSYS_ALT,
|
||||
|
@ -847,7 +858,8 @@ static _st_eventsys_t _st_kq_eventsys = {
|
|||
_st_kq_pollset_del,
|
||||
_st_kq_fd_new,
|
||||
_st_kq_fd_close,
|
||||
_st_kq_fd_getlimit
|
||||
_st_kq_fd_getlimit,
|
||||
_st_kq_destroy
|
||||
};
|
||||
#endif /* MD_HAVE_KQUEUE */
|
||||
|
||||
|
@ -856,7 +868,6 @@ static _st_eventsys_t _st_kq_eventsys = {
|
|||
/*****************************************
|
||||
* epoll event system
|
||||
*/
|
||||
|
||||
ST_HIDDEN int _st_epoll_init(void)
|
||||
{
|
||||
int fdlim;
|
||||
|
@ -1193,6 +1204,17 @@ ST_HIDDEN int _st_epoll_is_supported(void)
|
|||
return (errno != ENOSYS);
|
||||
}
|
||||
|
||||
ST_HIDDEN void _st_epoll_destroy(void)
|
||||
{
|
||||
if (_st_epoll_data->epfd >= 0) {
|
||||
close(_st_epoll_data->epfd);
|
||||
}
|
||||
free(_st_epoll_data->fd_data);
|
||||
free(_st_epoll_data->evtlist);
|
||||
free(_st_epoll_data);
|
||||
_st_epoll_data = NULL;
|
||||
}
|
||||
|
||||
static _st_eventsys_t _st_epoll_eventsys = {
|
||||
"epoll",
|
||||
ST_EVENTSYS_ALT,
|
||||
|
@ -1202,7 +1224,8 @@ static _st_eventsys_t _st_epoll_eventsys = {
|
|||
_st_epoll_pollset_del,
|
||||
_st_epoll_fd_new,
|
||||
_st_epoll_fd_close,
|
||||
_st_epoll_fd_getlimit
|
||||
_st_epoll_fd_getlimit,
|
||||
_st_epoll_destroy
|
||||
};
|
||||
#endif /* MD_HAVE_EPOLL */
|
||||
|
||||
|
|
1
trunk/3rdparty/st-srs/public.h
vendored
1
trunk/3rdparty/st-srs/public.h
vendored
|
@ -156,6 +156,7 @@ extern int st_sendmsg(st_netfd_t fd, const struct msghdr *msg, int flags, st_uti
|
|||
|
||||
extern st_netfd_t st_open(const char *path, int oflags, mode_t mode);
|
||||
|
||||
extern void st_destroy(void);
|
||||
extern int st_thread_setspecific2(st_thread_t thread, int key, void *value);
|
||||
|
||||
#ifdef DEBUG
|
||||
|
|
9
trunk/3rdparty/st-srs/sched.c
vendored
9
trunk/3rdparty/st-srs/sched.c
vendored
|
@ -229,6 +229,15 @@ int st_init(void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* Destroy this Virtual Processor
|
||||
*/
|
||||
void st_destroy(void)
|
||||
{
|
||||
(*_st_eventsys->destroy)();
|
||||
}
|
||||
|
||||
|
||||
#ifdef ST_SWITCH_CB
|
||||
st_switch_cb_t st_set_switch_in_cb(st_switch_cb_t cb)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue