Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poco::Util::Timer Cancel(true) hangs forever #103

Open
JyotstnaDeviChintala opened this issue Dec 3, 2020 · 0 comments
Open

Poco::Util::Timer Cancel(true) hangs forever #103

JyotstnaDeviChintala opened this issue Dec 3, 2020 · 0 comments

Comments

@JyotstnaDeviChintala
Copy link

JyotstnaDeviChintala commented Dec 3, 2020

Expected Behavior

When a Poco::Util::Timer is Cancelled using Cancel(true) while a Cancel(false) is already in execution state, it hangs forever.

Actual Behavior

Clear all the pending notifications and exit gracefully without hanging.

Steps to Reproduce

  1. Create a Poco::Util::Timer timer.
  2. Trigger timer.cancel().
  3. Immediately call timer.cancel(true);

Poco::Util::Timer timer1; timer1.cancel(). timer1.cancel(true);

(please make this a SSCCE, if applicable and reasonable)

macchina.io Version

macchina.io-2018.11.06-7c725bf8

Compiler and Version

gcc

Operating System and Version

Windows 10, Android x86_64 and amd64

Other Relevant Information

Proposed solution:

The second pending cancel notification (cancel(true) , which has an _finished event waiting is never set. This needs to be set, before clearing the queue.

namespace Poco { namespace Util {

class TimerNotification: public Poco::Notification { public: virtual void set(); }

class CancelNotification: public TimerNotification { public: bool execute() { ... else if (pNf.cast<CancelNotification>()) { pNf->set(); } } void set() { _finished.set(); } }

} }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant