lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] Requirement that sys_thread_t is integer (or pointer)?


From: Ajay Bhargav
Subject: Re: [lwip-users] Requirement that sys_thread_t is integer (or pointer)?
Date: Tue, 16 Nov 2021 07:59:23 +0530

I feel the port assumes thread creation should always be a success and if fails then assert is called. So the return value is always non zero. I believe this cannot be used in a production scenario where error needs to be reported and mitigated properly depending on what kind of system are you working with. You do not want to stall the whole system for failure of one part.

Semaphore and mbox are returned as pointers and error code defines whether operation was successful or not.

Take the port as an example only.

Regards,
Ajay Bhargav

On Mon, Nov 15, 2021, 11:59 PM Grant Edwards <grant.b.edwards@gmail.com> wrote:
On 2021-11-15, Ajay Bhargav via lwip-users <lwip-users@nongnu.org> wrote:

> You can define it as integer or pointer based on your system.

Yes, I know I can.

I want to know if it is _required_ to be an integer or pointer.

> Its definately not a structure.

It definitely is a structure in the freeRTOS port which I was told was
a good example to look at when the documentation proved to be
incomplete

Here's the current stable contrib freeRTOS port:

https://git.savannah.nongnu.org/cgit/lwip/lwip-contrib.git/tree/ports/freertos/include/arch/sys_arch.h?h=STABLE-2_1_0_RELEASE

lines 81-83:

    struct _sys_thread {
      void *thread_handle;
    };
    typedef struct _sys_thread sys_thread_t;

And here's where that's used

https://git.savannah.nongnu.org/cgit/lwip/lwip-contrib.git/tree/ports/freertos/sys_arch.c?h=STABLE-2_1_0_RELEASE

lines 463-485:

    sys_thread_t
    sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
    {
      ...
      sys_thread_t lwip_thread;
      ...
      lwip_thread.thread_handle = rtos_task;
      return lwip_thread;
    }

The types sys_sem_t and sys_mbox_t are also similar structures.

--
Grant


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

reply via email to

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