JeffBobbo/cppInterval — pull request #1 by FaTony (2014-06-24 00:14:41+00:00)
Title: Redone by FaTony

So, mr. "These weapons coding sucks, all aboard a fork boat" - later - "If it ain't broke, don't fix it". Let me school you a bit.

So you have a class here which essentially delays some "event" you say, but you put it into a while loop to burn CPU cycles or waste battery life.

Well, I decided to write it properly in only ISO C++11, no ugly hacks you there.

First, we are no longer in the 70s, this is multithreaded world, that's why I wait on a separate thread. And I use a condition variable and sleep while nothing is happening to save power/battery.

Next, plain ints? Oh, boy, this is so last century, people learned about type-rich programming, that's why, I have it into a template, of course, different clocks for different folks, you know? Also, you didn't have a check for negative values, ugh.

You call that documentation? Bleh, take a look at proper Doxygen one.

Finally, the "test", oh my. Plain new and delete? That's just a memory leak waiting to happen. Ever heard about exception safety?

While loop again, removed.

Have a nice day.