On Tue, Feb 01, 2011 at 12:32:19AM -0600, Nitin Garg wrote: > +/* Atomic compare and exchange. These sequences are not actually atomic; > + there is a race if *MEM != OLDVAL and we are preempted between the two > + swaps. However, they are very close to atomic, and are the best that a > + pre-ARMv6 implementation can do without operating system support. > + LinuxThreads has been using these sequences for many years. */
Assuming no SMP, could this be fixed by querying a cycle counter and determining that no context change took place? I'm not familiar with ARM, but it's an idea.. A better fix would probably be to create a global lock on the atomic compare and exchange function so that only one thread can execute a compare and exchange at a time. This would impact performance rather badly, but that's better than having subtle race condition bugs that occur randomly once in 5 years of execution... Rich _______________________________________________ uClibc mailing list [email protected] http://lists.busybox.net/mailman/listinfo/uclibc
