Multithreading with GLUT and OpenGL

I am writing an application in which there are 3 sources of asynchronous inputs: user input devices such as the mouse and keyboard, external messages which result in items being added to the scene, and a timer that wakes up once a second and redraws the scene.

I have taken great pains to ensure that all async inputs are serialized via a message queue. No matter when a message arrives, it is put on a queue and processed sequentially.

Yet I continue to get xlib async errors which freeze the OpenGL window and kill the app.

Any ideas on how to solve this?