[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] pbuf alloc/free locks
From: |
Kieran Mansley |
Subject: |
[lwip-users] Re: [lwip] pbuf alloc/free locks |
Date: |
Thu, 09 Jan 2003 00:44:56 -0000 |
On Fri, 22 Feb 2002, Adam Dunkels wrote:
> One way to distinguish between an out-of-memory situation and a lockout would
> be to let pbuf_alloc() return a special PBUF_ALLOC_LOCKED value when
> allocation fails because of a lockout. The reason for not blocking in
> pbuf_alloc() is that it should be a very quick function suitable for use in a
> high-priority thread and that the caller could implement a retry mechanism
> instead of doing this in pbuf_alloc(). A retrying mechanism could look like
> this, for instance:
>
> p = pbuf_alloc();
> while(p == PBUF_ALLOC_LOCKED) {
> yield();
> p = pbuf_alloc();
> }
That would be fine. I'll try implementing the different return code and
let you know how I get on.
Cheers,
Kieran
[This message was sent through the lwip discussion list.]