Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

Can I avoid mutexes by using globals?

avoid mutexes
0
Posted

Can I avoid mutexes by using globals?

0

> > 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

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123