I was taught that once you start CPR you keep going until the EMS arrive, someone takes over for you, or you physically cannot do it anymore.
This is absolutely the case--as my sister the paramedic growls at the TV screen on a regular basis.
CPR can help to re-establish a very weak heartbeat, or very occasionally re-start a stopped heart, as Bear says--when it's being done by people who know what they're doing and are doing it properly.