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 mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users

Reply via email to