8470cd0be9
And add a test that shows how this can happen when multiple threads are accessing the scheduler, which fails if atomic sections are not used.