[
https://issues.apache.org/jira/browse/THRIFT-4292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16154750#comment-16154750
]
ASF GitHub Bot commented on THRIFT-4292:
----------------------------------------
Github user jeking3 commented on a diff in the pull request:
https://github.com/apache/thrift/pull/1337#discussion_r137163123
--- Diff: lib/cpp/src/thrift/concurrency/TimerManager.cpp ---
@@ -290,11 +292,23 @@ void TimerManager::add(shared_ptr<Runnable> task,
const struct timeval& value) {
}
void TimerManager::remove(shared_ptr<Runnable> task) {
- (void)task;
Synchronized s(monitor_);
if (state_ != TimerManager::STARTED) {
throw IllegalStateException();
}
+ std::vector<task_iterator> toRemove;
--- End diff --
I'd recommend using the prefix/postfix method to walk and erase here in
order to avoid iterator invalidation:
bool found = false;
for (task_iterator it = taskMap_.begin(); it != taskMap_.end(); ) {
if (ix->second->runnable() == task) {
found = true;
taskMap_.erase(it++);
} else {
++it;
}
}
if (!found) {
throw NoSuchTaskException();
}
> TimerManager::remove() is not implemented
> -----------------------------------------
>
> Key: THRIFT-4292
> URL: https://issues.apache.org/jira/browse/THRIFT-4292
> Project: Thrift
> Issue Type: Bug
> Components: C++ - Library
> Reporter: Francois Ferrand
>
> The function is currently not implemented.
> This is not critical for Thrift, since it is not used there, but prevents
> using it in thrift-based code.
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)