DNS thread-safe functions

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

DNS thread-safe functions

matteo.cogi@alice.it

Dear all,

I would like to ask some questions about the thread-safe functions.

According the http://www.nongnu.org/lwip/2_0_x/pitfalls.html page, in the OS mode, all the callback-style APIs function must only be called from the TCPIP thread.
In the OS mode, the functions belongs to NETIF, DHCP, DNS, … modules require corresponding thread-safe functions to be used from threads different from TCPIP thread.
For example instead of calling directly the netif_set_up function it’s necessary use the netifapi_netif_set_up function, or instead of calling directly the dhcp_start function it’s necessary use the netifapi_dhcp_start function.

I am looking for the thread-safe function corresponding to the dns_setserver function. I am using LwIP 2.1.2, but I don’t find it.

At this point I would know if there is a thread-safe function corresponding to the dns_setserver or if I should build a similar function myself. In this last case, which function could I take as a model?.

Thanks in advance for your attention and for your suggestions.
Regards



_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: DNS thread-safe functions

goldsimon@gmx.de
Am 29.01.2020 um 16:37 schrieb [hidden email]:

> Dear all,
>
> I would like to ask some questions about the thread-safe functions.
>
> According the http://www.nongnu.org/lwip/2_0_x/pitfalls.html page, in
> the OS mode, all the callback-style APIs function must only be called
> from the TCPIP thread.
> In the OS mode, the functions belongs to NETIF, DHCP, DNS, … modules
> require corresponding thread-safe functions to be used from threads
> different from TCPIP thread.
> For example instead of calling directly the /netif_set_up/ function it’s
> necessary use the /netifapi_netif_set_up/ function, or instead of
> calling directly the /dhcp_start/ function it’s necessary use the
> /netifapi_dhcp_start/ function.
>
> I am looking for the thread-safe function corresponding to the
> /dns_setserver /function. I am using LwIP 2.1.2, but I don’t find it.

I don't think such a function exists.

>
> At this point I would know if there is a thread-safe function
> corresponding to the /dns_setserver/ or if I should build a similar
> function myself. In this last case, which function could I take as a model?.

The simple solution would be to enable LWIP_TCPIP_CORE_LOCKING and
surround your call with LOCK_TCPIP_CORE()/UNLOCK_TCPIP_CORE().

Regards,
Simon

>
> Thanks in advance for your attention and for your suggestions.
> Regards

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users
Reply | Threaded
Open this post in threaded view
|

Re: DNS thread-safe functions

Ajay Bhargav-2
You can write a simple wrapper function for DNS setup and use tcpip_callback to call it from TCPIP thread context. There is also tcpip_try_callback.

Regards,
Ajay Bhargav

On Wed, Jan 29, 2020, 10:41 PM [hidden email] <[hidden email]> wrote:
Am 29.01.2020 um 16:37 schrieb [hidden email]:
> Dear all,
>
> I would like to ask some questions about the thread-safe functions.
>
> According the http://www.nongnu.org/lwip/2_0_x/pitfalls.html page, in
> the OS mode, all the callback-style APIs function must only be called
> from the TCPIP thread.
> In the OS mode, the functions belongs to NETIF, DHCP, DNS, … modules
> require corresponding thread-safe functions to be used from threads
> different from TCPIP thread.
> For example instead of calling directly the /netif_set_up/ function it’s
> necessary use the /netifapi_netif_set_up/ function, or instead of
> calling directly the /dhcp_start/ function it’s necessary use the
> /netifapi_dhcp_start/ function.
>
> I am looking for the thread-safe function corresponding to the
> /dns_setserver /function. I am using LwIP 2.1.2, but I don’t find it.

I don't think such a function exists.

>
> At this point I would know if there is a thread-safe function
> corresponding to the /dns_setserver/ or if I should build a similar
> function myself. In this last case, which function could I take as a model?.

The simple solution would be to enable LWIP_TCPIP_CORE_LOCKING and
surround your call with LOCK_TCPIP_CORE()/UNLOCK_TCPIP_CORE().

Regards,
Simon

>
> Thanks in advance for your attention and for your suggestions.
> Regards

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users

_______________________________________________
lwip-users mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-users