1. Overview
In the Live555-server library, the use of single-threaded implementation of multi-user requests for video data, which seems to be multi-threaded to achieve the function, and the user requests the video data flow convergence is perfect, its execution is very efficient.
How is live555 implemented single-threaded? What is the reference point of its powertrain system?
2. Power system principle
An irrelevant topic:
Someone a has a bunch of tasks to handle, but he can only do one task at a time (single-threaded), sometimes for one task will trigger other tasks, and sometimes others will continue to explain the task, and the task has priority and priorities. A how to complete the task in accordance with certain rules.
The arrangements for a are as follows:
Write each separate task on a note, put it in the manager, and take one of the most urgent notes from the manager each time; When the task is triggered by another task, a new note is put into the manager, and if someone is explaining a new task, write a new note into the manager. A in the manager before taking the note, you must first ask if there is someone to arrange a new task for him, so that a can be timely to accept the tasks assigned by others.
The basic process of a is as follows:
This is a strict requirement for each task of a processing, that is, the task processing time is short, can not wait or sleep in the process of processing the task.
Basic operation of the task:
For tasks placed in the list, synchronization tasks are required before each task is taken out, not sequentially.
The corresponding relationship is as follows:
The topic loop corresponds to the Basictaskscheduler::singlestep function.
1. Ask if a task has been scheduled:
Select the socket section and the Select function. Here you need to understand the use of the Select function.
2. Task Manager corresponding to the Fdelayqueue variable, in the manager to take the task to handle the corresponding Fdelayqueue.handlealarm ()
3. Put the task in the manager for the corresponding
EnviR (). TaskScheduler (). Scheduledelayedtask function
For live555 have any other questions, please email to [email protected], we all a discussion.
Transferred from: http://blog.csdn.net/wjh_monkey/article/details/42024427
Go Live555 Single Thread principle