Exit the Program when i close the last Window.

I have a problem that i need to continue the program after i close all window create by glut.
I beleave that when i close all window of glut, the framework use the function ‘exit’ to close the program.
I want to know if i can configure to NOT close the program when i close all this windows.

I can’t close my program, because the glut is a part of my program. I have another socket, gui and threads running.

I resolve my problem putting

#include <gl/glut.h>

But it gave me another problem. This make a block thread waiting for nothing. How can i kill all thread create by glut. I want to restore the original state when i inicialize the glut.

I try to put :

static void exitWindow ( int i ) {
pthread_exit ( 0 ) ;

__glutCreateWindowWithExit ( “title” , exitWindow ) ;

But it not work!!!

I think a good rule of thumb is that if you plan to stray too far from the beaten path with GLUT, you should break out your machete and start hacking your own path.