The question “how long before they stop CPR” is affected by a large number of variables, so even if I were to say “about 20 minutes in most cases,” it wouldn’t be very meaningful.
Outside a hospital setting, as has been noted, EMS must follow certain standing orders. However these will rarely include termination of resuscitation except in very specific cases (non-survivable injuries, rigor mortis, etc.) Usually a verbal physician order will be needed.
Many agencies still transport cardiac arrest victims to the hospital, despite overwhelming evidence that this does not increase survival (with certain rare exceptions). The patient’s best chance is to be managed in the field.
What gets people back from cardiac arrest is rock-star quality CPR and early defibrillation. (With, as always, certain exceptions.)
In the hospital the duration of resuscitation will be affected by many things including the attending physician’s own experiences and philosophy (and what journal article he or she last read).
Where once CPR might be performed in shifts for hours (Been part of those!) the pendulum has swung to shorter resuscitations, and many docs will consider calling it after about 20 minutes. Some research has suggested a small additional number of patients might benefit from longer attempts, but from what I’ve been seeing, it’s unusual these days to go longer than 30 minutes.
But what’s the patient’s temperature? Those who go into arrest from severe hypothermia have survived hours of pulselessness!
What’s the EKG showing? Despite the miserable prognosis after 20 minutes of CPR, many are reluctant to quit when there’s still a shockable rhythm (V-fib or pulseless V-tach). “Let’s try one more shock!”
What caused the initial arrest? There’s a similar reluctance to stop when the cause is something “fixable.”
What’s the emotional component? Is the patient a child or young person? A member of the medical team?
What’s the family’s reaction? I’ve done many “social resuscitations,” working long after any reasonable expectation of survival, just because the family needed the extra time to feel certain everything possible had been done. Sometimes you’re just there to help the survivors.