Skip to content
This repository has been archived by the owner on Jun 23, 2022. It is now read-only.

fix: fix the bug that threads don't stop when shared_io_service is released #350

Merged
merged 3 commits into from
Dec 6, 2019

Conversation

levy5307
Copy link
Contributor

@levy5307 levy5307 commented Dec 6, 2019

In shared_io_service, there are some threads running. But shared_io_service doesn't have a destructor, so these threads can't be stopped.
So this pull request add a destructor for it to stop these threads.

@vagetablechicken
Copy link
Member

这个和timer的联系是什么?

@levy5307
Copy link
Contributor Author

levy5307 commented Dec 6, 2019

这个和timer的联系是什么?

timer用到了shared_io_service做io,然后创建了一个shared_io_service:

_timer.reset(new boost::asio::deadline_timer(tools::shared_io_service::instance().ios));

所以即使调用了_timer->cancel,shared_io_service里的thread也没有停止

@neverchanje neverchanje changed the title fix: fix the bug that threads doesn't stop when shared_io_service is released fix: fix the bug that threads don't stop when shared_io_service is released Dec 6, 2019
neverchanje
neverchanje previously approved these changes Dec 6, 2019
Copy link
Member

@vagetablechicken vagetablechicken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋

@levy5307 levy5307 dismissed stale reviews from vagetablechicken and neverchanje via daa54e4 December 6, 2019 03:11
@neverchanje neverchanje merged commit fdb19b1 into XiaoMi:master Dec 6, 2019
@neverchanje neverchanje added the type/bug-fix This PR fixes a bug. label Dec 6, 2019
@levy5307 levy5307 deleted the shared-io-bug.patch branch May 26, 2020 06:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.12.2 type/bug-fix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants