Is getaddrinfo() in the SDK thread safe?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Is getaddrinfo() in the SDK thread safe?

ソリューションへジャンプ
1,113件の閲覧回数
atm2024
Contributor III

Hi everyone,

I'm trying to build an application that uses FreeRTOS and the lwip stack.
I'm using the MIMXRT1064-EVK with version 2.14.0 of the SDK.

Using getaddrinfo() in two tasks at the same time does not work correctly.
If I run freeaddrinfo() after getaddrinfo() in the first task, it works fine in the second task.

Is this behavior as specified?

If I want to use getaddrinfo() at the same time, is there no choice but to use a semaphore or mutex to guard it until freeaddrinfo()?

Thanks in advance.

0 件の賞賛
返信
1 解決策
1,088件の閲覧回数
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @atm2024,

This behavior is expected. This is the description that accompanies the function on the netdb.c file:

EdwinHz_0-1709327670570.png

You can use the function in both tasks as long as you call the freeaddrinfo() function for each of the getaddrinfo() before trying to do another getaddrinfo() on the second task.

BR,
Edwin.

 

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,089件の閲覧回数
EdwinHz
NXP TechSupport
NXP TechSupport

Hi @atm2024,

This behavior is expected. This is the description that accompanies the function on the netdb.c file:

EdwinHz_0-1709327670570.png

You can use the function in both tasks as long as you call the freeaddrinfo() function for each of the getaddrinfo() before trying to do another getaddrinfo() on the second task.

BR,
Edwin.

 

0 件の賞賛
返信