Sounds like you're heading for a very complex design with lots of
threads. That's a good way to run into deadlock issues. The best
way to avoid deadlock IMHO is to introduce the absolute minimum
number of threads, and put a well-understood interface between each
thread and the rest of the world.
For instance, what if all your API functions did was queue drawing
requests, and you had a single long-lived worker thread taking requests
off the queue and executing them? (Or maybe two worker threads, if
you like.) That way, you'll allow the user's app to run in parallel with
your rendering, and you'll only have a single interface across which
to worry about thread safety.
The cost would be that the caller would not be allowed to change
stuff he passed pointers to until your API was done with it.
And therein lies the design challenge.
- Dan
-- (The above is just my personal opinion; I don't speak for my employer, except on the occasional talk show.)- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/