Multithreading and OpenGL

Hi,
I’m experiencing problems running multithreaded openGL applications:
I’m using Xfree 4.03 and NVdrivers 0.9-769

To make some tests, I’ve modified Sam’s port to SDL of Nehe’s OpenGL
tutorial (lesson07.c):
there is only a few changes:
the old main is now called in a new thread:

int main(int argc,char **argv)
{
SDL_Thread *thr;
thr=SDL_CreateThread(old_main,NULL);
SDL_WaitThread(thr,NULL);
SDL_Quit();
return 0;
}

everything runs fine until the end.
at exit I have a segfault in __glNV4SwapBuffers() from libGLcore

anyone experienced the same problems ?

Thomas