To detach a rendering context from a thread, make it not current. You can do this by calling the wglMakeCurrent function with the parameters set to NULL. The following is a sample of this simple task:
// detach the current rendering context from the thread
wglMakeCurrent(NULL, NULL);