Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: userland atomics
On May 4, 2:39pm, Matt Thomas wrote:
} On Dec 12, 2008, at 6:58 PM, John Nemeth wrote:
}
} > Do we have any kind of atomic operations in userland? I'm
} > working
} > with Asterisk 1.6.0.1 on NetBSD 5.99.3. Its configure script trys to
} > link this program (along with a lot of #define):
} >
} > int
} > main ()
} > {
} > int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);
} > ;
} > return 0;
} > }
} >
} > For some reason, the corfigure script believes that it is successful;
} > however, linking of Asterisk fails later due to a missing symbol.
}
} That's because in a gcc later than ours that becomes a builtin to gcc.
Supposedly it trys to link that. It should fail at configure
time. The configure.ac snippet is:
AC_MSG_CHECKING(for compiler atomic operations)
AC_LINK_IFELSE(
AC_LANG_PROGRAM([], [int foo1; int foo2 = __sync_fetch_and_add(&foo1, 1);]),
AC_MSG_RESULT(yes)
AC_DEFINE([HAVE_GCC_ATOMICS], 1, [Define to 1 if your GCC C compiler provides at
omic operations.]),
AC_MSG_RESULT(no)
)
} What you want to look at is atomic_ops(3).
I'll keep that in mind. Right now, I just want to get it working.
}-- End of excerpt from Matt Thomas
Home |
Main Index |
Thread Index |
Old Index