Make batch updates and delivery of a new frame into an atomic operation.
Before this patch, there was a chance that batch updates could be delivered to the compositor thread (destroying old resources) and then a render operation could be invoked before arrival of the new frame. This would cause the compositor thread to attempt to render frame N with the resources of frame N+1, which would usually crash. Closes #160.