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

Add/Remove watchers at any time #8

Closed
shafreeck opened this issue Aug 19, 2015 · 1 comment
Closed

Add/Remove watchers at any time #8

shafreeck opened this issue Aug 19, 2015 · 1 comment
Assignees
Milestone

Comments

@shafreeck
Copy link
Owner

We can just add/remove watchers before calling cetcd_multi_watch* so far. It is not flexible enough. What I expect is add or remove watchers at any time including after starting watching.

@shafreeck shafreeck added this to the v0.1.0 milestone Aug 19, 2015
@shafreeck shafreeck assigned shafreeck and unassigned shafreeck Aug 19, 2015
@shafreeck shafreeck assigned shafreeck and unassigned shafreeck Aug 23, 2015
@shafreeck
Copy link
Owner Author

It is difficult to add/remove watchers dynamic after starting the multi_watch routine because curl is not thread-safety and it is complex and not expected to introduce a lock. I made it work by a more simple and reasonable way.

  • cetcd_multi_watch/cetcd_multi_watch_async pass an array of watchers as an argument.
  • cetcd_multi_watch/cetcd_multi_watch_async can be called multiple times with another array of watchers.

Now, with above mechanisms you can

  • Add / Remove watchers before calling cetcd_multi_watch*
  • Add more watchers and call cetcd_multi_watch* again
  • Stop any watcher after calling cetcd_multi_watch*, it will be freed after being stopped.

See c0e6c5b

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

No branches or pull requests

1 participant