[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [lwip-users] Destruction of socksem and selectsem in sockets.c
From: |
Goldschmidt Simon |
Subject: |
RE: [lwip-users] Destruction of socksem and selectsem in sockets.c |
Date: |
Wed, 6 Sep 2006 10:39:47 +0200 |
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
;-)
Simon.