site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Thread-index: AcipI1XjlEwBqhUWEd2rrQAdT0T19A== Thread-topic: Where is atomicqueue? User-agent: Microsoft-Entourage/11.4.0.080122 On 4/24/08 3:17 PM, "Terry Lambert" <tlambert@apple.com> wrote:
On Apr 24, 2008, at 10:34 AM, Army Research Lab wrote:
On 4/24/08 11:40 AM, "Shawn Erickson" <shawnce@gmail.com> wrote:
On Thu, Apr 24, 2008 at 8:30 AM, Shawn Erickson <shawnce@gmail.com> wrote:
On Thu, Apr 24, 2008 at 4:35 AM, Army Research Lab <ckaran@arl.army.mil
wrote:
I've been poking through the man pages, and discovered the docs for <libkern/OSAtomic.h>; I see the documentation for atomic and for spinlock, but 'man barrier' also lists atomicqueue. Unfortunately, although the man pages claim that I should find it, it isn't there. I also can't find anything like it in /usr/include. Does it exist?
BTW, I'm looking at all of this on a OS X 10.4.11 machine...
<http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/T hr eadSafety/chapter_5_section_6.html>
[0:505] > find /usr/include -name "OSAtomic.h" /usr/include/libkern/OSAtomic.h
That is on a 10.4.11 system with Xcode 2.5.
Ah maybe you are talking about that header not containing the definition for OSAtomic queue?
From the 10.5 man page...
"Most of these functions first appeared in Mac OS 10.4 (Tiger). The "Orig" forms of the boolean operations, the "int", "long" and "ptr" forms of compare-and-swap, and lockless enqueue/dequeue first appeared in Mac OS 10.5 (Leopard)."
The atomic queue does exist on 10.4 when in the kernel.
OK, maybe that is the problem then; I did look in /usr/include/libkern/OSAtomic.h before I posted, but there is just a comment about the queue, not the queue itself. Do I have to download the Darwin sources to get access to it? Note that I'm just curious here, the only thing I need is spinlock, and if I'm clever, I won't even need that.
Short answer:
(1) It's protected by #ifdef __ppc__, so it's PPC only
(2) It's in a header <libkern/OSAtomic.h>, so you should only _expect_ to be able to use it in the kernel; the fact that there are some inline functions there notwithstanding
(3) The atual implementaiton is as an external symbol in the Libkern and System6.0 exports for PPC only
So to get at it you will need to be linked against the kernel (you will need to be either kernel code or a KEXT), you will need to be running PPC-only, and you will need to declare an explicit dependency for your KEXT on an exported symbol set or on the entire kernel.
OK, are there spinlocks in user space? I want to try a couple of experiments with some code, just to see if pthread_mutex_lock() is better, or if spinlocking is better. 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
participants (1)
-
Army Research Lab