On Thursday 08 February 2007, Asko Kauppi wrote: > - Control of the thread execution (percentage, done, cancelled) can > be done in a way that the two threads don't write on same fields. If > only one thread writes, and the other reads, there is no need for > locking. Or locking is kind of built into the data usage. do you mean a thread-safe FIFO? sure they're great... and usually implemented using semaphores. > There's a minimal critical section you know critical sections are also a locking operation, right? it's easy to implement them using semaphores; or the other way around, if you like. in all, my point is that if you use threads (and i think the'll be more and more inescapable with multiple-core chips getting so comon), then you have to decide on a few primitives (a FIFO might be the easiest, i used some on my helper threads toolkit), and build your functionality on top of that. but unfortunately, there are very few multiplatform options. in LuaThreads, Diego wrote a very thin adaptor library to get a subset of a pthreads-like API on windows. it's very minimal, i think only 200 or so lines of C. once you have that, it's easy to build everything else. -- Javier
Attachment:
pgp_AZlgjPK2k.pgp
Description: PGP signature