lwip-users
[Top][All Lists]
Advanced

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

[lwip-users] Why does user code need to lock tcp core?


From: Bas Prins
Subject: [lwip-users] Why does user code need to lock tcp core?
Date: Thu, 17 Jun 2021 11:46:13 +0200

Hi all,

I just found out that my lwipopts.h was lacking quite a lot, which completely disabled the core locking assert. After fixing this, I did run into a few asserts. But all in places where I am not expecting them.

Why do I need to lock for example:

    LOCK_TCPIP_CORE();
    netif_set_default(&pppos_netif);
    ppp = pppos_create(&pppos_netifppp_output_cbppp_link_status_cbnullptr);
    if (!ppp)
    {
        logger.WriteDebug(LoggingCategoryPppClient"Failed to create pppos client");
        return;
    }
    ppp_connect(ppp0);
    UNLOCK_TCPIP_CORE();

or calls like this

    LOCK_TCPIP_CORE();
    err_t err = httpc_get_file(
        &ip
        port
        "/513KB.zip"
        &settings
        rec_fn
        nullptr
        nullptr);
    UNLOCK_TCPIP_CORE();

As far as I understand there I no need at all to make this a user code responsibility. The lwip functions could perfectly do this first hand for me

I can imagine a minor performance deal there. But if that's the argument, it could be made configurable, right? If the user of the library doesn't want to bother with these locks, at the cost of some unnecessary lock/unlocks, they could opt for that in the lwipopts. 

Would this be something that could be interesting to improve or am I missing something here? 

Best regards, bas



reply via email to

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