pthread_spinlock_t & intrspin_t


Does any one know what is the significance of pthread_spinlock_t & intrspin_t (spinlock)?..or what sort of exclusion do they provide?

spinlocks are like mutex’s except that they can work in interrupt handlers where no OS calls are allowed. This is necessary when you have multiple processors.

Actually spinlocks (the pthread_spin_lock call) are not interrupt safe (from the doc’s).

The InterruptLock call (with the intrspin_t variable) is what you want to use with multiple processors / interrupt handlers.

I recall from a few years ago using 6.3.0 that one downside to spinlocks was that they didn’t trigger priority inversion processing in the kernel. What I discovered was that a high priority task that called spinlock waited infinitely spinning in a tight loop for the lock to be released by a lower priority task that never got any CPU to run. Hence, I avoid spinlock like the plague.


I guess I’m confused. I wasn’t thinking of a function that calls the OS like pthread_…

I thought there was some call that provided mutex like behavior at the hardware level.

yeah…there are sleepon locks and condvar locks…they are very suitable i guess…but i need to evaluate them…

thanks tim & maschoen