|
|
|
@ -61,6 +61,7 @@ SrsThread::SrsThread(ISrsThreadHandler* thread_handler, int64_t interval_us)
|
|
|
|
|
|
|
|
|
|
tid = NULL;
|
|
|
|
|
loop = false;
|
|
|
|
|
_cid = -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SrsThread::~SrsThread()
|
|
|
|
@ -68,6 +69,11 @@ SrsThread::~SrsThread()
|
|
|
|
|
stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SrsThread::cid()
|
|
|
|
|
{
|
|
|
|
|
return _cid;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int SrsThread::start()
|
|
|
|
|
{
|
|
|
|
|
int ret = ERROR_SUCCESS;
|
|
|
|
@ -83,6 +89,11 @@ int SrsThread::start()
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// wait for cid to ready, for parent thread to get the cid.
|
|
|
|
|
while (_cid < 0) {
|
|
|
|
|
st_usleep(10 * SRS_TIME_MILLISECONDS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -111,6 +122,7 @@ void SrsThread::thread_cycle()
|
|
|
|
|
{
|
|
|
|
|
int ret = ERROR_SUCCESS;
|
|
|
|
|
|
|
|
|
|
_cid = _srs_context->get_id();
|
|
|
|
|
srs_assert(handler);
|
|
|
|
|
|
|
|
|
|
_srs_context->generate_id();
|
|
|
|
|