Re: [AD] Test patch |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Chris wrote:
Peter Wang wrote:I think automatically switching to another thread would really hurt performance if all mutexes worked that way (and this is surely the domain of the thread system and not Xlib).I wouldn't be so sure. The thread that's blocked waiting would pretty much be asleep so the main program is getting a boost while it's holding the lock. Once it unlocks, it should pass control to the waiting thread since it left prematurely before.
Context switches are not free, though. The more switching, the lower the system throughput. It increases responsiveness, of course.
Maybe we could try something using condition variables?That looks ugly... I'd be content just warning to yield or rest every loop iteration if you're doing a lot of operations on the screen/video bitmaps.
I did a mini test using the condition variables idea and it didn't seem to work. I'll search around for something else.
I don't like the idea of telling the user to yield. It ought to Just Work, even if yielding is a good idea in many cases.
BTW, don't you find that you get rather different numbers in the test program with your rest(0) patch?
Peter
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |