1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00
This commit is contained in:
winlin 2021-11-15 11:10:39 +08:00
parent 440f29b758
commit 93242918ad
6 changed files with 21 additions and 3 deletions

View file

@ -30,6 +30,8 @@ The changelog for SRS.
## SRS 4.0 Changelog
* v4.0, 2021-11-15, For [#1708](https://github.com/ossrs/srs/pull/1708): ST: Print log when multiple thread stop one coroutine. (#1708). v4.0.198
* v4.0, 2021-11-14, Merge [#2732](https://github.com/ossrs/srs/pull/2732): WebRTC: Fail to publish RTC automatically for HTML5. (#2732). v4.0.197
* v4.0, 2021-11-13, Merge [#2729](https://github.com/ossrs/srs/pull/2729): RTC: check audio track exist when negotiate (#2729). v4.0.196
* v4.0, 2021-11-09, Merge [#2721](https://github.com/ossrs/srs/pull/2721): Rtc2Rtmp: Use RTP timestamp to identify video frames. v4.0.195
* v4.0, 2021-11-07, Merge [#2711](https://github.com/ossrs/srs/pull/2711): Config: Guess config files by [FHS](https://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard). v4.0.194

View file

@ -125,6 +125,7 @@ SrsFastCoroutine::SrsFastCoroutine(string n, ISrsCoroutineHandler* h)
trd = NULL;
trd_err = srs_success;
started = interrupted = disposed = cycle_done = false;
stopping_ = false;
// 0 use default, default is 64K.
stack_size = 0;
@ -138,6 +139,7 @@ SrsFastCoroutine::SrsFastCoroutine(string n, ISrsCoroutineHandler* h, SrsContext
trd = NULL;
trd_err = srs_success;
started = interrupted = disposed = cycle_done = false;
stopping_ = false;
// 0 use default, default is 64K.
stack_size = 0;
@ -192,9 +194,14 @@ srs_error_t SrsFastCoroutine::start()
void SrsFastCoroutine::stop()
{
if (disposed) {
if (stopping_) {
srs_error("thread is stopping by %s", stopping_cid_.c_str());
srs_assert(!stopping_);
}
return;
}
disposed = true;
stopping_ = true;
interrupt();
@ -225,6 +232,9 @@ void SrsFastCoroutine::stop()
if (trd_err == srs_success && !cycle_done) {
trd_err = srs_error_new(ERROR_THREAD_TERMINATED, "terminated");
}
// Now, we'are stopped.
stopping_ = false;
return;
}

View file

@ -163,6 +163,10 @@ private:
bool disposed;
// Cycle done, no need to interrupt it.
bool cycle_done;
private:
// Sub state in disposed, we need to wait for thread to quit.
bool stopping_;
SrsContextId stopping_cid_;
public:
SrsFastCoroutine(std::string n, ISrsCoroutineHandler* h);
SrsFastCoroutine(std::string n, ISrsCoroutineHandler* h, SrsContextId cid);

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 4
#define VERSION_MINOR 0
#define VERSION_REVISION 196
#define VERSION_REVISION 198
#endif