lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Correct way to use SNTP safely


From: Wayne Uroda
Subject: Re: [lwip-users] Correct way to use SNTP safely
Date: Fri, 22 Sep 2017 15:11:02 +1000

Hi Simon,

I am calling only sntp_setservername and sntp_init from my code.

sntp_setservername is fairly benign and more or less atomic on my platform.

sntp_init though calls sntp_request, which calls sntp_send_request etc. these functions in turn can call sys_timeout which could corrupt the timeout linked list if another thread happened to be in a critical part of code at the same time.

I concede I might be too paranoid, but I'd rather look stupid asking the question than not :)



On Fri, Sep 22, 2017 at 2:16 PM, Simon Goldschmidt <address@hidden> wrote:
Wayne Uroda wrote:
> This got me to thinking, are the SNTP functions (such as sntp_init) meant to be called only from a particular thread, namely the tcpip_thread?

Yes.
 
> Every other lwip function I've used has a wrapper which invokes functions on the tcpip thread via the mailbox mechanism.

Well, things in src/api is meant to be called from other threads. All the rest is single-threaded only. Sadly, this might not be clearly visible from the include file structure...

Which functions are you talking about?


Simon

_______________________________________________
lwip-users mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/lwip-users


reply via email to

[Prev in Thread] Current Thread [Next in Thread]