The truth is: a city cop, a street cop, a road cop, puts his life on the line and is at risk of being shot, nice guy or schmuck.
That's not exactly as true as it may seem. Job fatality stats indicate that it is significantly more dangerous to be a logger, farmer, rancher, pilot, fisherman, or even a garbageman. As far as getting shot goes, it's much more likely to happen to a convenience store clerk than a cop. In a typical year it is also generally the case that self-inflicted and traffic fatality cop deaths exceed those who die in the line of fire.
I don't note this to diminish the sacrifice of those who die at the hands of a bad guy, but the portrayal of cops as if they are inherently some sort of self-sacrificing altruistic class of heroes who live with the sword of Damocles constantly upon their heads is pure mythology. It's also a rather insidious mythology as it breeds a mentality that places officer safety above all else - even to the point that they are willing to (and frequently do) kill another human being to avoid even the most obscure, minor, and far-fetched perceived "threats" to their own person.
+1