tasklwIP - A Lightweight TCP/IP stack - Tasks: task #10421, adding return value to tcpip_init()

 
 

You are not allowed to post comments on this tracker with your current authentication level.

task #10421: adding return value to tcpip_init()

Submitter:  Martin Velek <allew>
Submitted:  Tue 25 May 2010 12:24:48 PM UTC
   
 
Category:  None Should Start On:  Tue 25 May 2010 12:00:00 AM UTC
Should be Finished on:  Fri 24 Dec 2010 12:00:00 AM UTC Priority:  5 - Normal
Status:  Cancelled Privacy:  Public
Assigned to:  None Percent Complete:  0%
Open/Closed:  Closed Planned Release:  None
Effort:  0.00

Jump to the original submission

Wed 11 Feb 2015 08:09:14 PM UTC, comment #6: 

Won't do: sys_thread_new must not fail.

Simon Goldschmidt <goldsimon>
Group administrator
Wed 21 May 2014 07:55:02 PM UTC, comment #5: 

This task should be closed because a better solution has been implemented in patch #8465 leaving the return value intact.

Martin Velek <allew>
Sat 25 Aug 2012 08:58:42 AM UTC, comment #4: 

Since 1.4.x has a return value for sys_thread_new, it should be easy to implement a return value for tcpip_init to err_t. I do not think that changing this api will break a compilation, only when someone treats unused return value as an error.

Martin Velek <allew>
Sat 12 Jun 2010 07:36:44 PM UTC, comment #3: 

I like the idea of letting tcpip_init return an err_t, but the problem here is that we currently don't have a define what sys_thread_new should return when creating a thread fails. I guess currently, many ports would just assert for success...

Anyway, adding a new define SYS_THREAD_NULL and letting tcpip_init check for that should be it.

On the other hand, tcpip_init asserts if creating the mbox fails, so another solution would probably be to remove the return value from sys_thread_new and document that ports should fail hard when they cannot create a thread.

Anyway, the current situation where sys_thread_new returns a value that is not checked anywhere is, well, "suboptimal" :-)

Simon Goldschmidt <goldsimon>
Group administrator
Tue 25 May 2010 01:05:04 PM UTC, comment #2: 

Background:
I am using UEZ framework(http://www.teamfdi.com/development-tools-kits/uez.php, a simple generic interface for RTOS(currently FreeRTOS), drivers, etc) and there is created a lot of semaphores, workspaces, ... in the dynamic memory(FreeRTOS implementation of heap_2).
After drivers initialisation there could be a situation when there is no more memory for stack of lwip task.

With current version (1.3.2) I have no chance to get status of the task initialization(true/false) without using some special hooks to the sys_thread_new function.

Also there could be also check if the creating "mbox = sys_mbox_new(TCPIP_MBOX_SIZE);" fails in tcpip_init().

Problems it is causing:
My lwip is a static library. I have no information about success of creating tcip/ip task.

Martin Velek <allew>
Tue 25 May 2010 12:36:57 PM UTC, comment #1: 

Can you give some background on why this is needed, or what problems it is causing?

Kieran Mansley <kieranm>
Group Member
Tue 25 May 2010 12:24:48 PM UTC, original submission:  

During the lwip initialisation in a RTOS environment is called function tcpip_init() that creates tcp-ip task.

Unfortunately the return type is "void" so there is no information to caller that the task was created.

I would suggest set the return value to "sys_thread_t" because the function that really creates task(sys_thread_new) returns "sys_thread_t".

The prototype:
sys_thread_t tcpip_init(void ( tcpip_init_done)(void ), void *arg);
The body:
sys_thread_t
tcpip_init(void ( initfunc)(void ), void *arg){
.....
return sys_thread_new(TCPIP_THREAD_NAME, tcpip_thread, NULL, TCPIP_THREAD_STACKSIZE, TCPIP_THREAD_PRIO);
}

Martin Velek <allew>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by allew (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-02-11 goldsimon StatusNone Cancelled
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code