main: Fix vtimer_sleep race condition, with help from Ludwig

See https://github.com/RIOT-OS/RIOT/issues/550
Some optimizations suggested by Ludwig