1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #906, #902, replace the endless thread with coroutine

This commit is contained in:
winlin 2017-05-29 17:56:26 +08:00
parent fc380fe48d
commit 44f542f77f
7 changed files with 28 additions and 151 deletions

View file

@ -26,74 +26,6 @@
#include <srs_kernel_error.hpp>
#include <srs_kernel_log.hpp>
ISrsEndlessThreadHandler::ISrsEndlessThreadHandler()
{
}
ISrsEndlessThreadHandler::~ISrsEndlessThreadHandler()
{
}
void ISrsEndlessThreadHandler::on_thread_start()
{
}
int ISrsEndlessThreadHandler::on_before_cycle()
{
return ERROR_SUCCESS;
}
int ISrsEndlessThreadHandler::on_end_cycle()
{
return ERROR_SUCCESS;
}
void ISrsEndlessThreadHandler::on_thread_stop()
{
}
SrsEndlessThread::SrsEndlessThread(const char* n, ISrsEndlessThreadHandler* h)
{
handler = h;
pthread = new internal::SrsThread(n, this, 0, false);
}
SrsEndlessThread::~SrsEndlessThread()
{
pthread->stop();
srs_freep(pthread);
}
int SrsEndlessThread::start()
{
return pthread->start();
}
int SrsEndlessThread::cycle()
{
return handler->cycle();
}
void SrsEndlessThread::on_thread_start()
{
handler->on_thread_start();
}
int SrsEndlessThread::on_before_cycle()
{
return handler->on_before_cycle();
}
int SrsEndlessThread::on_end_cycle()
{
return handler->on_end_cycle();
}
void SrsEndlessThread::on_thread_stop()
{
handler->on_thread_stop();
}
ISrsOneCycleThreadHandler::ISrsOneCycleThreadHandler()
{
}