mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
ST: Support set context id while thread running. v5.0.72
This commit is contained in:
parent
9525511032
commit
dc20d5ddbc
12 changed files with 96 additions and 15 deletions
|
|
@ -62,10 +62,19 @@ const SrsContextId& SrsThreadContext::get_id()
|
|||
}
|
||||
|
||||
const SrsContextId& SrsThreadContext::set_id(const SrsContextId& v)
|
||||
{
|
||||
return srs_context_set_cid_of(srs_thread_self(), v);
|
||||
}
|
||||
|
||||
void SrsThreadContext::clear_cid()
|
||||
{
|
||||
}
|
||||
|
||||
const SrsContextId& srs_context_set_cid_of(srs_thread_t trd, const SrsContextId& v)
|
||||
{
|
||||
++_srs_pps_cids_set->sugar;
|
||||
|
||||
if (!srs_thread_self()) {
|
||||
if (!trd) {
|
||||
_srs_context_default = v;
|
||||
return v;
|
||||
}
|
||||
|
|
@ -78,16 +87,12 @@ const SrsContextId& SrsThreadContext::set_id(const SrsContextId& v)
|
|||
srs_assert(r0 == 0);
|
||||
}
|
||||
|
||||
int r0 = srs_thread_setspecific(_srs_context_key, cid);
|
||||
int r0 = srs_thread_setspecific2(trd, _srs_context_key, cid);
|
||||
srs_assert(r0 == 0);
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
void SrsThreadContext::clear_cid()
|
||||
{
|
||||
}
|
||||
|
||||
impl_SrsContextRestore::impl_SrsContextRestore(SrsContextId cid)
|
||||
{
|
||||
cid_ = cid;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue