spinlock: support non-EAL thread
In non-EAL thread, lcore_id always be LCORE_ID_ANY. It can't be used as unique id for recursive spinlock. Then use rte_gettid() to replace it. Signed-off-by: Cunming Liang <cunming.liang@intel.com> Acked-by: Olivier Matz <olivier.matz@6wind.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit is contained in:
parent
fd4a5ce87d
commit
ca2e2dab07
@ -179,7 +179,7 @@ static inline void rte_spinlock_recursive_init(rte_spinlock_recursive_t *slr)
|
||||
*/
|
||||
static inline void rte_spinlock_recursive_lock(rte_spinlock_recursive_t *slr)
|
||||
{
|
||||
int id = rte_lcore_id();
|
||||
int id = rte_gettid();
|
||||
|
||||
if (slr->user != id) {
|
||||
rte_spinlock_lock(&slr->sl);
|
||||
@ -212,7 +212,7 @@ static inline void rte_spinlock_recursive_unlock(rte_spinlock_recursive_t *slr)
|
||||
*/
|
||||
static inline int rte_spinlock_recursive_trylock(rte_spinlock_recursive_t *slr)
|
||||
{
|
||||
int id = rte_lcore_id();
|
||||
int id = rte_gettid();
|
||||
|
||||
if (slr->user != id) {
|
||||
if (rte_spinlock_trylock(&slr->sl) == 0)
|
||||
|
@ -87,7 +87,7 @@ RTE_DECLARE_PER_LCORE(rte_cpuset_t, _cpuset); /**< Per thread "cpuset". */
|
||||
/**
|
||||
* Return the ID of the execution unit we are running on.
|
||||
* @return
|
||||
* Logical core ID(in EAL thread) or LCORE_ID_ANY(in non-EAL thread)
|
||||
* Logical core ID (in EAL thread) or LCORE_ID_ANY (in non-EAL thread)
|
||||
*/
|
||||
static inline unsigned
|
||||
rte_lcore_id(void)
|
||||
|
Loading…
Reference in New Issue
Block a user