[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
POSIX Spin Locks
- Date: Thu, 20 Jul 2006 11:18:12 -0500
- From: joel.sherrill at oarcorp.com (Joel Sherrill)
- Subject: POSIX Spin Locks
Hi,
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.
http://www.opengroup.org/onlinepubs/009695399/functions/pthread_spin_lock.html
====================================
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
becomes available.
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?
--joel
- Follow-Ups:
- POSIX Spin Locks
- From: gregory.menke at gsfc.nasa.gov (gregory.menke at gsfc.nasa.gov)