Re: see if a mutex lock is taken?
site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=auYX2ml8q4quTylyG/ynNaIlVQhLyovJD3n5VUFV5rA=; b=IFBOCQuxG6EgDdtD0P0zyIEPdeVlucirktdWJHNyeRnLdZO6adtVlzkIq4U6QRFqQGveGAZOTm1GMRSu0LYcM0XWqa+N/iJ6g9FrodFjpirFKBOhF3BXahELblT+MooJ6xXr8ioLk6P0F0SHmZpE8SOGOcA4UEjPNPCVoDDjSE8= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=a/W7UmT9GV1cXSDRjYwxHS4ij+/3sVLs+ZKKkjPp829Ge10gogNiKatsX3Hzwq1KdY5725FS+ui+w3Kpk2kXM7n21Uuic/EZ/vSys9rM6aUkK51IQ9/lknpmkIeeBFUreQAU3YgEcICEZcHp93OZAdw2iDymFa5HHtKj/bfWYoY= Hi Greg, as far I understand you want to use /System/Library/Frameworks/Kernel.framework/Headers/kern/locks.h there is a private method: extern boolean_t lck_mtx_try_lock(lck_mtx_t *lck); but as I tried to explain you this API does the job for you, it is lock system/api for a mutex_t nm /mach_kernel | grep lck_mtx_try_lock 0019aa30 T _lck_mtx_try_lock 004d1b03 D _lck_mtx_try_lock_lockstat_patch_point 0019a930 T _lck_mtx_try_lock_spin 004d1aff D _lck_mtx_try_lock_spin_lockstat_patch_point if you absolutely want to use it just declare it as extern in your header extern boolean_t lck_mtx_try_lock(lck_mtx_t *lck); further information: take a look here xnu/osfmk/i386/i386_lock.s or here xnu/osfmk/ppc/hw_lock.s and sure the IOKit interface http://developer.apple.com/documentation/Darwin/Reference/KernelIOKitFramewo... call me mousse,\\ enjoy -mmw On Feb 11, 2008 6:54 PM, Greg <greg@kinostudios.com> wrote:
On Feb 11, 2008, at 3:42 PM, mm w wrote:
hi Greg, yep these mechanisms exist, this is the first things that you implement when you write a lock system no matter on what: islockable and islocked
try to understand, what you do (if you use a lck object (locked)) if your lock object has been created, a lock has been aquired when you create a lock object, the lock system test it for you
-mmw
Hi mmw, thanks for your reply. I was specifically wondering how I could do this from a kernel extension? I don't see a header in Kernel.framework that contains any try_lock functions for lck_mtx_t.
Thanks!
- Greg
Hmm... I've found this in the sources to xnu, but I can't find this in the Kernel.framework. Perhaps I should have mentioned that I'm writing a kernel extension. Does this exist for kernel extensions, and if so how do I access it? Right now I'm just linking against Kernel.framework, which doesn't seem to have this header.
Thanks!
- Greg
-- -mmw _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com
participants (1)
-
mm w