This is an important topic and doesn't deserve to become the usual pre-allo battle. Few would disagree that empathy with families facing a death or critical illness is important but that a physician must maintain some emotional distance from the situation.
A good guideline is to make sure that the caregiver is not behaving in a way that requires the FAMILY to comfort THEM. So, if you start crying in front of the family and they are telling you "it's okay" then it's time to step back.
In practical terms, almost everyone will shed a few tears the first few times a patient of theirs dies, even if they weren't that close to the situation. Those who haven't seen someone die can be severely affected by actually seeing someone die. Ultimately, with experience, it gets better. Those who really have a tough time with this probably ought to avoid critical care settings in their final practice. In my experience in dealing with interns and residents having their first close encounter with the death of a pediatric patient, a few days and a little time with loved ones does a lot and it's much better the second time around.
No matter how used to death one becomes, and in my business a baby dies in our NICU on at least a weekly basis, usually more often, there will be some that are tougher than others and this doesn't ever go away. Anyone who isn't affected by watching a 3 year old say "goodbye" to their newborn baby sibling isn't entirely human. But in all situations, it's possible to learn to show compassion without becoming so emotional that you aren't helping anyone.
One important value of learning to control your emotions at the time of death of a patient is that it will make you more able to stay around the family at that time. Many doctors feel very uncomfortable being physically present at the bedside when a patient actually dies. This may be due to a sense of guilt or failure, a feeling that the family doesn't want you there, or general discomfort. In reality, most families want the doctor there as well as the nurse and will tell you specifically if they don't.
Finally, one of the most valuable experiences anyone can have in medical training is to participate in a post-death discussion with family members about autopsy findings or other type of follow-up with a family after the death. Not an easy experience for a med student to get, but very worthwhile.
And to recreate an old SDN debate, none of these skills can be learned in didactic empathy classes, only by actually being in the situation. Thus, folks with lots of medical experiences are a bit ahead of the curve here.