[dpdk-dev,v7,15/19] eal: fix recursive spinlock in non-EAL thraed
Commit Message
In non-EAL thread, lcore_id alrways be LCORE_ID_ANY.
It cann'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>
---
lib/librte_eal/common/include/generic/rte_spinlock.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -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)