Arsen Arsenović wrote:
> > __eloop_threshold.
> 
> ... I am certain this is a race
> condition in linkat etc due to this condition.  ;)
> 
> Those should be atomic accesses.

The code is:

  static long int sysconf_symloop_max;
  if (sysconf_symloop_max == 0)
    sysconf_symloop_max = __sysconf (_SC_SYMLOOP_MAX);

When an expression, such as __sysconf (_SC_SYMLOOP_MAX), is side-effect
free and always returns the same value, it is OK to evaluate it in several
threads in parallel and cache it. In the worst case, the expression gets
evaluated multiple times. Storing the same value in the same location (of
type 'int') is OK not only on those platforms where an 'int' access is atomic,
but even on architectures (such as m68k) where it isn't.

So, no locking / atomic / volatile is needed here.

Bruno




Reply via email to