[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Allocating and deallocating an mbox in different threads
From: |
Andrew Lentvorski |
Subject: |
[lwip-users] Allocating and deallocating an mbox in different threads |
Date: |
Wed, 18 Apr 2007 03:19:21 -0700 |
User-agent: |
Thunderbird 1.5.0.10 (Macintosh/20070221) |
I have been trying to sort out which functions get called in which
threads when using the sockets API. Everything is pretty clean except
for the following code in api_lib.c:
/* If we are closed, we indicate that we no longer wish to receive
data by setting conn->recvmbox to SYS_MBOX_NULL. */
if (p == NULL) {
memp_free(MEMP_NETBUF, buf);
sys_mbox_free(conn->recvmbox);
conn->recvmbox = SYS_MBOX_NULL;
return NULL;
}
Now, I understand about allocating pbufs and messages in one thread and
deallocating them in another. That's okay, it doesn't break the
abstraction since those only go one way and all of the information is
explicitly encapsulated in the data.
In this instance, though, the freeing of the mbox is being used as a
reverse message between the API layers. That's uncool and makes all
kinds of assumptions about the implementation of mbox.
Is there any way to change this to an actual explicit reverse message
and let the original thread do the deallocation?
I don't yet know enough about the API abstractions between the RAW API,
the netconn API, and the socket API to feel that I can generate an
intelligent patch. Does anybody have a suggestion?
Thanks,
-a
- [lwip-users] Allocating and deallocating an mbox in different threads,
Andrew Lentvorski <=