Thanks for all the answers!
To begin with I'll try to clarify some things.
What I am able to do:
I can create new threads. I can share objects between these threads and put locks on them when needed.
What I want to do:
Load textures from image files without having the game freeze during the loading process. Loading a texture takes approximately one second.
How I'm trying to do it:
Putting the loading process in a separate thread.
(Note: I do not intend to do any drawing from the loading thread. I just want to handle the loading of the image files from the secondary memory (hard drive) to OpenGL textures in the primary memory (RAM)).
How I think it should be done:
According to this article http://hacksoflife.blogspot.com/2008/02/creating-opengl-objects-in-second.html
(and the others I have found) there is one way to go with this. You create two separate OpenGL contexts, one for the thread that loads and creates the objects (like textures, vertex buffer object etc.) and one for the rendering.. Once the loader-thread has created the objects it "sends" them to the main thread, where they are used.
How platform independent code for this could look:
eerrrrr... eehhh... ummmm.. ?
As soon as I try to use the image loading code in the new thread I get a segfault
I don't know how to create a new OpenGL context in the new thread either, glut doesn't seem to allow it..?
You have given me suggestion for some alternative solutions:
Hajo suggested that I could use SDL. It's quite possible that SDL has support for multi-threaded loading. Have you used SDL for loading OpenGL texture objects or do you know of a tutorial dealing with this?
LtJax came with a very interesting suggestion. I just realized that I can use photoshop to cut up the images in tiny pieces (using the slice tool). This way I can load a tiny piece of the texture every frame, preventing the game to completely freeze. In no way an ideal solution, but it's currently my main back-up-plan.