Opened 5 years ago

Closed 5 years ago

#13051 closed Feature Requests (invalid)

Do the spin lock respect priority?

Reported by: alex_slt@… Owned by: timblechmann
Milestone: To Be Determined Component: atomic
Version: Boost 1.63.0 Severity: Optimization
Keywords: Cc: Andrey.Semashev@…

Description

suppose one thread 'th1' try to lock to a resource and after that another thread 'th2' try to lock the same resource. if I use pthread_spin_lock is possible that th2 take lock to resource before th1. Boost::spin_lock solve this behavour? if I use Boost::spin_lock priority is respected?

Change History (1)

comment:1 by Andrey Semashev, 5 years ago

Cc: Andrey.Semashev@… added
Resolution: invalid
Status: newclosed

There is no spin_lock implementation in Boost.Atomic. There are probably spin lock implementations in other libraries, but I don't think any of them is public. You'll have to specify what particular implementation you are interested in.

In general though, spin locks tend to provide no guarantees about fairness or priority support. You typically have to use special mutex types that provide these guarantees.

Note: See TracTickets for help on using tickets.