Subj : Re: Reader Writer Puzzle To : comp.programming.threads From : Joe Seigh Date : Tue Jun 14 2005 11:38 pm bonnie.caballero@ktd-kyocera.com wrote: > Can we start with a simple solution using semaphores, mutexes or > read-write locks? Then maybe we can look at more advanced approaches. > As long as your not implementing a rwlock, it's easy. Get a read lock for read operations and get a write lock for write operations (insert, delete) on the queue. Using a mutex wouldn't be considered a reader-writer solution. And don't bother with semaphores. Usually assignments of this sort want you to implement a read/write lock with mutexes and condition variables and count of readers, writers, waiting readers, and waiting writers with tweaks to prevent reader starvation or writer starvation. -- Joe Seigh When you get lemons, you make lemonade. When you get hardware, you make software. .