Subj : Re: How to manage time-slicing in Pthreads programs? To : comp.programming.threads From : Joe Seigh Date : Sun Feb 20 2005 08:31 am On 19 Feb 2005 21:40:20 -0800, D'artagnan wrote: > > > How? Are these ways involving signals? I kind of remember signals in > Linux threads are somewhat goofy. Am I wrong? Unix signals are brain damaged beyond redemption. > > Basically, what I'm headed for here is that I want user-level atomic > operations. Locks in Pthreads synchronize accesses to shared locations, > but multiple threads can still execute the same operation at the same > time. An atomic operation is one that once started by a thread it runs > to its completion without being swapped out and back. > Sound like lock-free. So, you have written or are planning to write your own lock-free stuff? If you're trying to avoid condition variables because they require a mutex you don't need, you can look at the eventcount stuff in http://atomic-ptr-plus.sourceforge.net/ It's futex (NPTL) based and is for 32 bit Linux only. Program logic with eventcounts looks a lot like program logic with condition variables. It's basically constraint driven. You may not notice a real performance advantage over condition variables since you can't get a lot of contention out of only two threads. -- Joe Seigh .