NEW YORK -- When you pass away, you might think that every piece of your body just shuts down. As turns out, your brain is still functioning even when your heart stops beating.

Researchers say it can take 20 seconds before your brain waves are no longer detectable. A pulmonologist told Live Science when someone does CPR, that's what gets the brain functioning again.

If your heart has stopped and doctors are able to get blood flowing to the brain, the person's perspective of what they remember can be fascinating.

It’s possible you were conscious that whole time, even if your heart wasn't pumping.

If you're wondering what prompted this curiosity about brainwaves, a new movie is in theaters called Flatliners. It's about a group of medical students who deliberately stop their hearts to discover the after-life.

Make it easy to keep up-to-date with more stories like this. Download the 10 News app now.

Have a news tip? Email, or visit our Facebook page or Twitter feed.