HappenLee commented on a change in pull request #5214:
URL: https://github.com/apache/incubator-doris/pull/5214#discussion_r554584621
##########
File path: be/src/olap/olap_server.cpp
##########
@@ -39,23 +39,28 @@ namespace doris {
// number of running SCHEMA-CHANGE threads
volatile uint32_t g_schema_change_active_threads = 0;
+// background threads is detached thread, but they will depend on 'this'
pointer.
+// so we should pass a shared_from_this ptr to make sure that the pointer is
not destroyed
+// before the thread exits
Status StorageEngine::start_bg_threads() {
RETURN_IF_ERROR(Thread::create(
"StorageEngine", "unused_rowset_monitor_thread",
- [this]() { this->_unused_rowset_monitor_thread_callback(); },
+ [this]() {
this->shared_from_this()->_unused_rowset_monitor_thread_callback(); },
Review comment:
Maybe we should not pass this, but the shared_ptr of storage engine
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]