mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine code, rename the sync call to common class.
This commit is contained in:
parent
0bb90145ba
commit
2f0ef87d6d
6 changed files with 43 additions and 41 deletions
|
@ -42,29 +42,31 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
* a video and pass it to the dvr again.
|
||||
* futhurmore, the aync call never block the main worker thread.
|
||||
*/
|
||||
class ISrsDvrAsyncCall
|
||||
class ISrsAsyncCallTask
|
||||
{
|
||||
public:
|
||||
ISrsDvrAsyncCall();
|
||||
virtual ~ISrsDvrAsyncCall();
|
||||
ISrsAsyncCallTask();
|
||||
virtual ~ISrsAsyncCallTask();
|
||||
public:
|
||||
virtual int call() = 0;
|
||||
virtual std::string to_string() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* the async callback for dvr.
|
||||
*/
|
||||
class SrsDvrAsyncCallThread : public ISrsThreadHandler
|
||||
* the async callback for dvr.
|
||||
* when worker call with the task, the worker will do it in isolate thread.
|
||||
* that is, the task is execute/call in async mode.
|
||||
*/
|
||||
class SrsAsyncCallWorker : public ISrsThreadHandler
|
||||
{
|
||||
private:
|
||||
SrsThread* pthread;
|
||||
std::vector<ISrsDvrAsyncCall*> callbacks;
|
||||
std::vector<ISrsAsyncCallTask*> tasks;
|
||||
public:
|
||||
SrsDvrAsyncCallThread();
|
||||
virtual ~SrsDvrAsyncCallThread();
|
||||
SrsAsyncCallWorker();
|
||||
virtual ~SrsAsyncCallWorker();
|
||||
public:
|
||||
virtual int call(ISrsDvrAsyncCall* c);
|
||||
virtual int execute(ISrsAsyncCallTask* t);
|
||||
public:
|
||||
virtual int start();
|
||||
virtual void stop();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue