lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [bug #21433] Calling mem_free/pbuf_free from interrupt cont


From: Simon Goldschmidt
Subject: [lwip-devel] [bug #21433] Calling mem_free/pbuf_free from interrupt context isn't safe
Date: Thu, 25 Oct 2007 20:03:25 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.8) Gecko/20071008 Firefox/2.0.0.8

Follow-up Comment #1, bug #21433 (project lwip):

My favourite solution for this is to create a new semaphore function
'sys_sem_tryget(sem)' which behaves much like 'sys_arch_mbox_tryfetch()'
(check if the semaphore is available, return SYS_ARCH_TIMEOUT if not; don't
block -> usable from interrupt context).

Then, if the semaphore is not available, put the struct mem on a list of
memory to free. This list is then freed both at the end of mem_free (from
application context) and at the start of mem_malloc (to make sure everything
is freed before allocating again), all the time protected by mem_sem.

Attached a patch, please comment!

The reason I'd change this fast is we could include sys_sem_tryget in 1.3.0
so most port-breaks are done now.

(file #14212)
    _______________________________________________________

Additional Item Attachment:

File name: mem_free_from_interrupt.patch  Size:3 KB


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/bugs/?21433>

_______________________________________________
  Nachricht geschickt von/durch Savannah
  http://savannah.nongnu.org/





reply via email to

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