mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add comments for srs thread, add never quit thread.
This commit is contained in:
parent
948d200ce1
commit
6f8c076b30
1 changed files with 99 additions and 87 deletions
|
@ -46,7 +46,19 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* which will cause the socket to return error and
|
||||
* terminate the cycle thread.
|
||||
*
|
||||
* Usage 1: stop by other thread.
|
||||
* Usage 1: loop thread never quit.
|
||||
* user can create thread always running util server terminate.
|
||||
* the step to create a thread never stop:
|
||||
* 1. create SrsThread field, with joinable false.
|
||||
* for example:
|
||||
* class SrsStreamCache : public ISrsThreadHandler {
|
||||
* public: SrsStreamCache() { pthread = new SrsThread("http-stream", this, SRS_AUTO_STREAM_SLEEP_US, false); }
|
||||
* public: virtual int cycle() {
|
||||
* // check status, start ffmpeg when stopped.
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* Usage 2: stop by other thread.
|
||||
* user can create thread and stop then start again and again,
|
||||
* generally must provides a start and stop method, @see SrsIngester.
|
||||
* the step to create a thread stop by other thread:
|
||||
|
@ -62,7 +74,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* }
|
||||
* };
|
||||
*
|
||||
* Usage 2: stop by thread itself.
|
||||
* Usage 3: stop by thread itself.
|
||||
* user can create thread which stop itself,
|
||||
* generally only need to provides a start method,
|
||||
* the object will destroy itself then terminate the thread, @see SrsConnection
|
||||
|
@ -83,7 +95,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* }
|
||||
* };
|
||||
*
|
||||
* Usage 3: loop in the cycle method.
|
||||
* Usage 4: loop in the cycle method.
|
||||
* user can use loop code in the cycle method, @see SrsForwarder
|
||||
* 1. create SrsThread field, with or without joinable is ok.
|
||||
* 2. loop code in cycle method, check the can_loop() for thread to quit.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue