I am trying to set up my program to do some cleanup when the user requests an exit, and was hoping to place code after the call to glutMainLoop(). I want to use the freeglut glutLeaveMainLoop() call to get out of the function.

Unfortunately, it seems like this isn't functional anymore -- even the included sample programs don't output their "Back from the 'freeglut' main loop" statements. Is there a more preferred way to get the functionality I'm after?