lwip-users
[Top][All Lists]
Advanced

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

RE: [lwip-users] Destruction of socksem and selectsem in sockets.c


From: clive
Subject: RE: [lwip-users] Destruction of socksem and selectsem in sockets.c
Date: Wed, 06 Sep 2006 11:55:05 +0100
User-agent: Demon-WebMail/2.0

address@hidden wrote:
> Hi Clive,
> 
> > Dear All,
> > 
> > In sockets.c, there are two semaphores that are created on 
> > first invocation, that are never destroyed - these are 
> > socksem and selectsem, created in alloc_socket() and 
> > event_callback() respectively. If I want to completely free 
> > all heap memory taken by the stack, these sems need to be 
> > destroyed as semaphore creation allocates memory on my OS.
> > 
> > The question is, where is it safe for them to be destroyed? 
> > My hunch is that it would be OK at the end of lwip_close(), 
> > immediately before the return statement.
> > 
> > Does anyone have any views on this?
> 
> This seems to be a general problem of the stack. Because in embedded
> systems, you normally don't need to shut down anything but just turn of
> power, this is not a problem for most lwIP-users. If you wanted to
> safely shut down the complete stack, you would need shutdown-functions
> corresponding to all the *_init() functions... But who would need that
> ;-)

Well, I have a management thread, a purpose of which is to kill errant tasks. 
Sure, I can destroy the task that LwIP occupies, but leaving a memory leak each 
time...

For my application, a reboot isn't really very polite.

Kind regards,

Clive Wilson





reply via email to

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