正在显示
3 个修改的文件
包含
7 行增加
和
4 行删除
@@ -293,10 +293,14 @@ private: | @@ -293,10 +293,14 @@ private: | ||
293 | virtual void dispose(); | 293 | virtual void dispose(); |
294 | // server startup workflow, @see run_master() | 294 | // server startup workflow, @see run_master() |
295 | public: | 295 | public: |
296 | + /** | ||
297 | + * initialize server with callback handler. | ||
298 | + * @remark user must free the cycle handler. | ||
299 | + */ | ||
296 | virtual int initialize(ISrsServerCycle* cycle_handler); | 300 | virtual int initialize(ISrsServerCycle* cycle_handler); |
301 | + virtual int initialize_st(); | ||
297 | virtual int initialize_signal(); | 302 | virtual int initialize_signal(); |
298 | virtual int acquire_pid_file(); | 303 | virtual int acquire_pid_file(); |
299 | - virtual int initialize_st(); | ||
300 | virtual int listen(); | 304 | virtual int listen(); |
301 | virtual int register_signal(); | 305 | virtual int register_signal(); |
302 | virtual int http_handle(); | 306 | virtual int http_handle(); |
@@ -129,11 +129,13 @@ namespace internal { | @@ -129,11 +129,13 @@ namespace internal { | ||
129 | if (ret) { | 129 | if (ret) { |
130 | srs_warn("core: ignore join thread failed."); | 130 | srs_warn("core: ignore join thread failed."); |
131 | } | 131 | } |
132 | + } | ||
132 | 133 | ||
133 | // wait the thread actually terminated. | 134 | // wait the thread actually terminated. |
134 | // sometimes the thread join return -1, for example, | 135 | // sometimes the thread join return -1, for example, |
135 | // when thread use st_recvfrom, the thread join return -1. | 136 | // when thread use st_recvfrom, the thread join return -1. |
136 | // so here, we use a variable to ensure the thread stopped. | 137 | // so here, we use a variable to ensure the thread stopped. |
138 | + // @remark even the thread not joinable, we must ensure the thread stopped when stop. | ||
137 | while (!really_terminated) { | 139 | while (!really_terminated) { |
138 | st_usleep(10 * 1000); | 140 | st_usleep(10 * 1000); |
139 | 141 | ||
@@ -142,7 +144,6 @@ namespace internal { | @@ -142,7 +144,6 @@ namespace internal { | ||
142 | } | 144 | } |
143 | srs_warn("core: wait thread to actually terminated"); | 145 | srs_warn("core: wait thread to actually terminated"); |
144 | } | 146 | } |
145 | - } | ||
146 | 147 | ||
147 | tid = NULL; | 148 | tid = NULL; |
148 | } | 149 | } |
-
请 注册 或 登录 后发表评论