Some airlines that fly long routes have crew rest facilities on board the aircraft, so that the primary crew can sleep while the relief pilots hold the fort. Unfortunately, lack of such facilities (and approval) doesn't stop some guys from nodding off. This story happened to a colleague of an ex-instructor of an acquaintance. (How's that for verification?)
The first officer leaves the flight deck to use the restroom and the captain locks the door behind him, as per policy. The door can only be opened from the inside.
When the first officer returns, the captain does not respond to the correct signal requesting admittance. Nor to the flight attendant's attempt to enter. Nor to discreet pounding on the door. Eventually in desperation, the FO gains access to the cockpit through a method I've been advised to edit out, which is too bad, because it's interesting.
Because it's a FOAF story, it's missing the what-happened-next details. What would you say? Or just leave it at "Thanks." Next trip with the guy, I'd pull an old fashioned wind-up alarm clock with a loud ringer out of my flight bag, set it for ten minutes hence, and leave it on my seat. If I didn't think he'd appreciate the joke, I'd set it when he wasn't looking and leave it inside my flight bag.
There are obviously a few serious issues raised by the story. Crew fatigue? What if the pilot locked in the flight deck had suffered a stroke or heart attack? And the method he used to gain access shouldn't work that way. A study on mental alertness shows that for the first three minutes after awakening, impairment could be as bad as if the person were legally drunk. Effects could last as long as two hours. This should also be a concern for long haul crew who wake up the captain before descent, or in an emergency.