POSIX Spin Locks
joel.sherrill at oarcorp.com
Thu Jul 20 16:18:12 UTC 2006
I am looking at the POSIX spinlock specification and can't
see why it can't be implemented as some mutex variation.
Yes I understand the "test and set and poll if not available"
technique but the OpenGroup page doesn't require that behavior.
The /pthread_spin_lock/() function shall lock the spin lock referenced
by /lock/. The calling thread shall acquire the lock if it is not held
by another thread. Otherwise, the thread shall spin (that is, shall not
return from the /pthread_spin_lock/() call) until the lock becomes
available. The results are undefined if the calling thread holds the
lock at the time the call is made. The /pthread_spin_trylock/() function
shall lock the spin lock referenced by /lock/ if it is not held by any
thread. Otherwise, the function shall fail.
From a user's perspective, a mutex lock does not return until the lock
RTEMS SuperCore mutexes are very efficient. I don't see the point of
not doing a simple implementation based upon SuperCore mutexes.
Any thoughts, comments, insights?
More information about the users