Fix wakeup of solution thread.

Check timer counter when resetting period and use a semaphore to
wake up.  Fixes #69