Re: ___spin_lock
Re: ___spin_lock
- Subject: Re: ___spin_lock
- From: alex <email@hidden>
- Date: Wed, 13 Dec 2006 15:00:36 -0800
some notes inside:
>On Dec 13, 2006, at 7:36 PM, alex wrote:
>
>>To answer your question: __spin_lock is usually called internally when you attempt to take a lock. If you look at the source code for the pthreads implementation you will see that the code first tries to spin on the lock before blocking the thread to wait for it.
>>
>>If the offset from __spin_lock + xxxx is huge than you can assume the stack is not accurate.
>>
>>Also, if it makes you feel any better I too get the error about not being able to locate cpu_capabilities.h and I also tend to crash gdb about 5 times a day doing simple work. There is nothing worse than not being able to trust your debugger but this is something you will get used to on the Mac. There has never been a good Mac debugger (other than Macsbug, IMHO).
>>
>
>thanks that does make me feel better
>
>so, spinning is like turning around, or trying to lock it without waiting for it?
yes'ish. You are still waiting, just differently...
Spinning is a term used to describe sitting in a for loop (and usually consuming the CPU). In the context of a mutex or lock this means attempting to gain access to the lock without the thread blocking. Or in other words, just sitting in a loop trying to gain access to the lock over and over again. This is in contrast to blocking the thread while the lock is busy and effectively waiting for it. There are performance reasons for all this nonsense.
>and i can say safely that if a thread is blocking and hanging in this ___spin_lock
>function, it is not my fault?
Without more information it's hard to tell whether or not this is your fault. If this is your code I would say it is almost certainly your fault. If you are calling another library and this is happening you need to do some more debugging and determine if the problem stems from the external code not being thread safe.
I tend to use 'Thread Viewer.app' when dealing with these sorts of issues, it's inside of /Developer/Applications/Perfomance Tools/
alex
>btw: i tried this 'sample' program i actually got it to work, great!
>however it displayed the same (incomplete) info as xcode
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden