lwip-devel
[Top][All Lists]
Advanced

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

RE : [lwip-devel] Adding attributes to sys_thread_new()


From: Frédéric BERNON
Subject: RE : [lwip-devel] Adding attributes to sys_thread_new()
Date: Tue, 21 Aug 2007 20:49:30 +0200

I've got the same problem, and I got a "workaround" :

Actually the lwIP source code contains only three sys_thread_new() calls:

sys_thread_new(tcpip_thread, NULL, TCPIP_THREAD_PRIO);
sys_thread_new(slipif_loop, netif, SLIPIF_THREAD_PRIO);
sys_thread_new(pppMain, (void*)pd, PPP_THREAD_PRIO);

If we know in which order you do these calls, you can use a static counter 
inside your sys_thread_new() implementation in your sys_arch.c, and use a lcoal 
table to pass to your OS function these parameters. Of course, you need to be 
sure about the order.

If your need is not for other tasks you create for your application part, so, 
perhaps you could add a sys_thread_new_ext() in your sys_arch with these extra 
parameters.

Last solution, which break ports, we could extend current sys_thread_new like 
this:

sys_thread_t sys_thread_new( char* name, void (* thread)(void *arg), void *arg, 
int stacksize, int prio);

For the three previous calls, we could add in opt.h some parameters like for 
*_THREAD_PRIO. By example

#ifndef TCPIP_THREAD_NAME
#define TCPIP_THREAD_NAME "tcpip_thread"
#endif

#ifndef TCPIP_THREAD_STACKSIZE
#define TCPIP_THREAD_STACKSIZE 10000
#endif

Etc...

Like this, you can adapt these parameters to your OS contraints (name lenght, 
stack size...).

The patch is minor, so, I'm in flavor to add it in 1.3.0, since we try to avoid 
port-breakage for next releases. More, it really port-break is sys_thread_new 
is directly used by the port or the application.

====================================
Frédéric BERNON 
HYMATOM SA 
Chef de projet informatique 
Microsoft Certified Professional 
Tél. : +33 (0)4-67-87-61-10 
Fax. : +33 (0)4-67-70-85-44 
Email : address@hidden 
Web Site : http://www.hymatom.fr 
====================================
P Avant d'imprimer, penser à l'environnement

-----Message d'origine-----
De : address@hidden [mailto:address@hidden De la part de Bill Florac
Envoyé : mardi 21 août 2007 16:27
À : address@hidden
Objet : [lwip-devel] Adding attributes to sys_thread_new()


I would like to propose that we amend the sys_thread_new() function to two 
additional arguments. 
char *task_name // task name (VOID if not used) 
int task_stack_size        // suggested task stack size.  0 = not specified 
I know this is a core function and I suppose it may break a lot of existing 
implementations but I think it helps keep the code separated between the IP 
stack and the application.  Currently, I have to keep tack of calls and call 
order to make sure I have the correct stack allotment for each call.  This make 
the sys_arch.c dependent on the application.  I know I can use the arg 
argument, but currently, I used this to pass on arguments to the OS.
This may be the wrong time for this as it seems we are cleaning up for a 1.3 
release but I wanted to get a feeling of what others thought.
Bill Florac 
address@hidden 

Attachment: Frédéric BERNON.vcf
Description: Frédéric BERNON.vcf


reply via email to

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