lwip-users
[Top][All Lists]
Advanced

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

Re: [lwip-users] sys_arch_mbox_fetch


From: address@hidden
Subject: Re: [lwip-users] sys_arch_mbox_fetch
Date: Thu, 15 Oct 2009 16:30:58 +0200
User-agent: Thunderbird 2.0.0.23 (Macintosh/20090812)

Your conservative approach is the right thing to do since basically, what you are trying to do is not supported! Calling netconn_close() while the connection waits in netconn_accept() means you are using one netconn from two different threads, which is not supported.

Simon


Fabian Koch wrote:

Hey all,

our sys_arch layer is very conservative at the moment. It basically makes Assertions at any given wrong turn. Also when someone is waiting for sys_arch_mbox_fetch to finish (e.g. netconn_accept()), and the mbox is deleted, it fires an Assertion. This happens now when I want to netconn_close() a connection that is in LISTEN and sits on its netconn_accept(). the recvmbox gets deleted.

So in short. Should sys_arch_mbox_fetch() just return "cleanly" when the mbox it is waiting for to fill itself is being deleted?

regards,
Fabian

------------------

u32_t sys_arch_mbox_fetch(sys_mbox_t mbox_t, void **msg, u32_t timeout)
        {
        tsSysMbox *mbox = (tsSysMbox *)mbox_t;
        long lStart = (long)OsGetTime();
        unsigned char        bResult;

        if(mbox != (tsSysMbox *)SYS_MBOX_NULL)
                {
                if(!timeout)
                        {
                        bResult = OsSemEnter(mbox->SemFetch);
                        if(!bResult)
                                {//invalid or deleted while waiting on
                                IF_DEBUG_HALT;
                                }
                        }
                else
[....]

where IF_DEBUG_HALT is a define that leads to assert(0);

-------------------------------

void sys_mbox_free(sys_mbox_t mbox_t)
        {
        tsSysMbox *mbox = (tsSysMbox *)mbox_t;

        if(mbox != (tsSysMbox *)SYS_MBOX_NULL)
                {
                if(!mbox->MsgQLevel)
                        {
                        OsSemDelete(mbox->SemPost);
                        OsSemDelete(mbox->SemFetch);
[.....]
------------------------------------------------------------------------

_______________________________________________
lwip-users mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/lwip-users





reply via email to

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