Multiple threads...

konan

Registered
I am converting an application I wrote into a plug-in for another application. I used GLUT (OpenGL utility toolkit) to make my application (the one being converted into a plug-in).

In the windows version, I was able to simply create another thread, and run my program in that thread, which creates it's own window, and bob's your uncle! However, when I try this on the Mac (with carbon), the window of my program pops up, but when I attempt to maipulate the window of the host application, it crashes.

I am pretty sure that this problem is caused by the fact that my program has it's own event loop (determined by the GLUT library), and it is interfering with the host's events.

I tried creating another process with MPCreateQueue, and it doesn't crash, but apparently there are limitations and I can't display windows properly (for example, the standard alert box will pop up with an OK button, but no text or title bar.

Does anybody know how I can get two completely separate GUI's running parallel to each other in the same program but different threads or processes?

Konan
 
In general, user interface work should all be done on the main thread. Not all of the UI is thread-safe.

I believe that doing a fork will solve your problem - since it will create a complete copy of your current process.

Wade
 
Thanx man. Now, what is the easiest method of communicating between forks? What would be simplest way of sending a block of data between forks?

Konan
 
This appears to be great. I may not have to do the separate forks after all, but this will definately help if I do.

Thanx,
Konan
 
Back
Top