Gallows Humor Meaning

(US, idiomatic) Comedy that still manages to be funny in the face of, and in response to, a tragic or hopeless situation.

Example: 1931, "German Falstaff" (review of The Mirror of Fools by Alfred Neumann), Time, 16 Jan.,
  Author Neumann defiantly admits why he wrote this historical-romantic farce: "Because I wanted to fight against the general and my personal depression, and because in hard and bad times there is always one tragicomic feeling in place—gallows humor."
1971, Kurt Vonnegut, Running Experiments Off: An Interview, in Conversations with Kurt Vonnegut
  The term was part of the language before Freud wrote an essay on it -- 'gallows humour.' This is middle European humour, a response to hopeless situations. It's what a man says faced with a perfectly hopeless situation and he still manages to say something funny. Freud gives examples: A man being led out to be hanged at dawn says, 'Well, the day is certainly starting well.' It's generally called Jewish humour in this country. Actually it's humour from the peasants' revolt, the thirty years' war, and from the Napoleonic wars. It's small people being pushed this way and that way, enormous armies and plagues and so forth, and still hanging on in the face of hopelessness. Jewish jokes are middle European jokes. And the black humourists are gallows humourists, as they try to be funny in the face of situations which they see as just horrible.
2005, Kurt Vonnegut, A Man without a Country, ISBN 9781583227138, p. 5,
  True enough, there are such things as laughless jokes, what Freud called gallows humor. . . . While we were being bombed in Dresden, sitting in a cellar with our arms over our heads in case the ceiling fell, one soldier said as though he were duchess in a mansion on a cold and rainy night, "I wonder what the poor people are doing tonight."