Can I avoid mutexes by using globals?
> > j> Now, I have implemented this without using a synchronization > > j> mechanism for the integer. Since I have only one writer, and > > j> multiple readers, and the datum is a simple integer, I believe I > > j> can get away with this. > But on the other hand why not do it correctly with locks? Locks > will make the code easier to maintain because it will be somewhat > self documenting (the call to rwlock() should give most programmers > a clue) and it will be more robust. In my experiance threaded > programs are more fragile and more difficult to debug than single > threaded programs. It is a good idea to keep thread syncronization > as controlled as you can, this will make debugging simpler. Remember that sign in “The Wizard of Oz”? “I’d go back if I were you.” When you port your program to the next OS or platform and a new bug appears… Could it be caused by your hack? Won’t it be fun trying to guess with each new bug? How will you prove to yourself that the bug is elsewhere? An