Github user Typz commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1353#discussion_r138845074
  
    --- Diff: lib/cpp/src/thrift/concurrency/TimerManager.h ---
    @@ -100,13 +108,26 @@ class TimerManager {
        */
       virtual void remove(stdcxx::shared_ptr<Runnable> task);
     
    +  /**
    +   * Removes a single pending task
    +   *
    +   * @param timer The timer to remove. The timer is returned when calling 
the
    +   * add() method.
    +   * @throws NoSuchTaskException Specified task doesn't exist. It was 
either
    +   *                             processed already or this call was made 
for a
    +   *                             task that was never added to this timer
    +   *
    +   * @throws UncancellableTaskException Specified task is already being
    +   *                                    executed or has completed 
execution.
    +   */
    +  virtual void remove(Timer timer);
    --- End diff --
    
    The old function removes *all* timers executing this task, and does this 
inefficiently by traversing the whole list.
    This new function removes a single timer in constant time [O(1)] which may 
be significant for large system with many timers.
    This does not impact the behavior of Thrift itself, since it does not rely 
on timer removal.


---

Reply via email to