Your book seems to be a bit confusing about the GD.finish() and GD.flush() commands. Just search for those terms to see what I mean.
I had an issue with a project where a motor controller responds correctly to input, but the display lags a second or two. I just guessed at the GD.finish(), applied right before the GD.swap() and it seems to work now, which I'm guessing it causes the program to wait for the GPU to finish all instructions rather than filling up a buffer somewhere. I'm still not sure about the GD.flush().
So the finish() blocks code execution until the GPU processes all the pending input. I guess that means that the maximum loop speed of a routine that includes a finish() then swap() is 60 times per second (the max framerate)?