Ryan Leavengood wrote: > On Tue, Sep 22, 2009 at 2:10 PM, Roland Plüss <roland@xxxxxxx> wrote: > >> Now it is possible I didn't get the implementation in Haiku but right now it >> looks to me that this semaphore implementation is like an ordinary mutex >> without condition support and that the posix compatibility layer simply >> emulates a condition variable using semaphores. >> > > Yes we implement condition variables using semaphores, which is not > "emulation", it is just one way to implement them. As Bruno implied > semaphores are a lower level thread primitive that can be used to > build higher level constructs such as condition variables, read-write > locks, queues, etc. I wrote the original pthread condition variable > implementation, which was improved by Ingo (who knows his stuff.) > > Now we do actually have kernel land condition variables too, which > might be implemented more directly, but I suspect they too are built > on lower level constructs. > > I didn't mean "emulation" in a negative way. With "emulating" I simply meant to provide a functionality which is not exposed directly using other constructs. Nothing wrong with that and the Posix compat layer does work ( at last my threading test cases in the engine pass so I assume so ). I can implementing this all using sems later on but right now it is easier for me to simply compile against pthreads support like I do on other Unix systems. -- Yours sincerely Plüss Roland Leader and Head Programmer - Game: Epsylon ( http://epsylon.rptd.ch/ , http://www.moddb.com/games/4057/epsylon ) - Game Engine: Drag(en)gine ( http://dragengine.rptd.ch , http://www.moddb.com/engines/9/dragengine ) - Normal Map Generator: DENormGen ( http://epsylon.rptd.ch/denormgen.php )