site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thread-index: AciqD9XnFKy5IxYDEd23XAAdT0T19A== Thread-topic: Synchronization primitives (was:Re: Where is atomicqueue?) User-agent: Microsoft-Entourage/11.4.0.080122 On 4/29/08 11:22 AM, "Shawn Erickson" <shawnce@gmail.com> wrote:
On Tue, Apr 29, 2008 at 8:18 AM, Shawn Erickson <shawnce@gmail.com> wrote:
On Tue, Apr 29, 2008 at 8:11 AM, Army Research Lab <ckaran@arl.army.mil> wrote:
I want to be able to use this from user space. Are there any functions that are supported from user space and capable of all that the OSAtomic* functions are?
If you are interested in support 10.4 and later then yes. Review...
<http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/atom ic.3.html>
<http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/spin lock.3.html>
As a note about how to explore things (man pages state libc is the library that provides these)...
Note this is on a Leopard (10.5) system.
[0:588] > nm -arch i386 /usr/lib/libc.dylib | grep OS <<SNIP>>
[0:590] > nm -arch ppc /usr/lib/libc.dylib | grep OS <<SNIP>>
The problem is that although I can find it in the library, I can't always find it in the headers. E.g. spinlock (and please forgive the line breaks; I'm at work, and they force us to use Entourage, and I have yet to figure out how to fix its line-breaking habits): anvil:/usr/lib ckaran$ find . -type f -exec nm -Afg -arch i386 {} \; 2>/dev/null | grep spin ./libauto.dylib: U __spin_lock ./libauto.dylib: U __spin_unlock ./libgmalloc.B.dylib: U __spin_lock_try ./libgmalloc.B.dylib: U __spin_unlock ./libMallocDebug.a:debug_malloc.o: U __spin_lock_try ./libMallocDebug.a:debug_malloc.o: U __spin_unlock ./libMallocDebug.A.dylib: U __spin_lock_try ./libMallocDebug.A.dylib: U __spin_unlock ./libnetsnmphelpers.5.2.1.dylib: 0000515d T _netsnmp_get_watched_spinlock_handler ./libnetsnmphelpers.5.2.1.dylib: 000054a7 T _netsnmp_register_watched_spinlock ./libnetsnmphelpers.5.2.1.dylib: 0000518f T _netsnmp_watched_spinlock_handler ./libSystem.B.dylib: 9010d48c T __spin_lock ./libSystem.B.dylib: 9010d484 T __spin_lock_try ./libSystem.B.dylib: a0002004 D __spin_tries ./libSystem.B.dylib: 9010d494 T __spin_unlock ./libSystem.B.dylib: 9010d48c T _spin_lock ./libSystem.B.dylib: 9010d494 T _spin_unlock ./libSystem.B_debug.dylib: 000fe210 T __spin_lock ./libSystem.B_debug.dylib: 000fe208 T __spin_lock_try ./libSystem.B_debug.dylib: 00184050 D __spin_tries ./libSystem.B_debug.dylib: 000fe218 T __spin_unlock ./libSystem.B_debug.dylib: 000fe210 T _spin_lock ./libSystem.B_debug.dylib: 000fe218 T _spin_unlock ./libSystem.B_profile.dylib: 00112f1c T __spin_lock ./libSystem.B_profile.dylib: 00112f14 T __spin_lock_try ./libSystem.B_profile.dylib: 0017c004 D __spin_tries ./libSystem.B_profile.dylib: 00112f24 T __spin_unlock ./libSystem.B_profile.dylib: 00112f1c T _spin_lock ./libSystem.B_profile.dylib: 00112f24 T _spin_unlock which means there is a spin_lock defined. anvil:/usr/include ckaran$ man spin_lock No manual entry for spin_lock anvil:/usr/include ckaran$ apropos spin_lock spin_lock: nothing appropriate anvil:/usr/include ckaran$ find . -type f -exec grep -H spin_lock {} \; anvil:/usr/include ckaran$ Which results in nothing. So, as Terry said earlier, it might be in there, but it may not be supported, which isn't a problem, as long as we know. Its knowing if it *IS* supported or not that is the trick. Thanks, Cem Karan _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com