multithread; how to tell opengl-thread to redraw
I'm fairly new at opengl and multithreading. That said I have the following problem:
I'm writing a numerical-analysis program which does a lot of computation. Therefor I want to use two threads, an opengl thread and a numerical thread.
How can I sensibly notify the GL-thread that computations have led to new data to be drawn. I can't use something like glutPostRedisplay() directly; the GL-thread doesn't react to that. I don't want the GL-thread to constantly check for a condition-flag in its idle function, thereby consuming lots of CPU-time.
Is the only sensible way to for GL's idle-func to check for a condition-flag and sleep for some micro-seconds if condition is not met (which is the best suggestion I've found sofar)????