PragmaTwice commented on code in PR #1493:
URL:
https://github.com/apache/incubator-kvrocks/pull/1493#discussion_r1227489897
##########
src/common/task_runner.h:
##########
@@ -42,13 +42,7 @@ class TaskRunner {
TaskRunner(const TaskRunner&) = delete;
TaskRunner& operator=(const TaskRunner&) = delete;
-
- ~TaskRunner() {
- if (state_ != Stopped) {
- Cancel();
- auto _ = Join();
- }
- }
+ ~TaskRunner() = default;
Review Comment:
Seems we need some guarantee for this object? i.e. the behavior will be
undefined while the taskrunner is destructed and the attached threads are still
running.
Can refer to std::jthread
(https://en.cppreference.com/w/cpp/thread/jthread/~jthread) and std::thread
(https://en.cppreference.com/w/cpp/thread/thread/~thread).
The previous dtor build such a guarantee like std::jthread, but I think we
can call `Join` explicitly as far as possible to prevent misunderstanding.
Removing such dtor cannot help the situation.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]