google/certificate-transparency — pull request #290 by pphaneuf (2014-11-28 18:39:20+00:00)
Title: Create an PeriodicClosure class.

Some improvements over the existing class, but at the same time, some of its issues (at destruction time) have not been fixed, only better documented.

One important thing you usually want to know when destroying this object is whether the closure will be called again. To support destruction from arbitrary threads, it would be easy to make the destructor block until the closure returns, but it would still not allow destroying the object from within the closure.

Since supporting destruction from arbitrary threads would be kind of complicated, and I'm not sure if @AlCutter even needs it, I figured I'd [YAGNI](http://en.wikipedia.org/wiki/You_aren%27t_gonna_need_it) it. I have a much better idea that will support stopping it from other threads **and** from the closure, but it requires some more support code, so I figured I'd put this out first, since it was easy (and might be enough to unblock @AlCutter!).