[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: |
Grant Edwards |
Subject: |
Re: [lwip-users] Requirement that sys_thread_t is integer (or pointer)? |
Date: |
Tue, 16 Nov 2021 14:49:16 -0000 (UTC) |
User-agent: |
slrn/1.0.3 (Linux) |
On 2021-11-16, goldsimon@gmx.de <goldsimon@gmx.de> wrote:
> Am 15.11.2021 um 18:03 schrieb Grant Edwards:
>> Is it required that sys_thread_t be a pointer or integer type?
>>
>> The documentation doesn't state that. The example implementation at
>> https://lwip.fandom.com/wiki/Porting_for_an_OS#Threads shows it as a
>> struct, and in the freeRTOS port it's a struct.
>>
>> But the test code assumes it's a pointer or integer type:
>>
>> 430 static void
>> 431 sockets_stresstest_conn_client(void *arg)
>> 432 {
>> ...
>> 456 if (LWIP_RAND() & 1) {
>> 457 sys_thread_t t;
>> ...
>> 463 t = sys_thread_new("sockets_stresstest_conn_client_r",
>> sockets_stresstest_conn_client_r, data, 0, 0);
>> 464 LWIP_ASSERT("thread != NULL", t != 0);
>
> That should probably be changed to use 'sys_thread_valid()' (which does
> not exist yet).
Thanks, that makes sense.
> The ' != 0' test is clearly not portable: any type should work.
I've changed my port so that sys_thread_t is an integer and 0 is
returned on failure. Now I can compile all of the tests cleanly. I
haven't figured out how to actually run them yet... ;)
--
Grant