On Wed, May 12, 1999 at 01:34:05PM -0700, Matthew Dillon wrote:
>     asleep() allows a subroutine deep in the call stack to specify an 
>     asynchronous blocking condition and then return a temporary failure 
>     up through the ranks.  At the top level, the scheduler sees and acts 
>     upon the asynchronous blocking condition.  Higher level routines do not

So if I get it right, this would give something like the code below.
Is that the idea? What's missing in the asleep/await code to use
them in such a way?

        soxxx()
        {
            for (;;) {
                await(&mbuf_slp);
                /* code */
                error = xxx(&mbuf_slp);
                if (error != ENOBUFS)
                    break;
            }
        }
        
        m_retry()
        {
            /* find an mbuf... */
            if (/* got an mbuf to return */)
                return mbuf;
            else {
                asleep(&mbuf_slp);
                return NULL;
            }
        }

        m_free()
        {
            /* Free mbuf... */
            wakeup(&mbuf_slp);
        }

And, unless I'm missing something, we still need to properly check
for NULL return values from m_get and friends.
-- 
Pierre Beyssac          p...@enst.fr


To Unsubscribe: send mail to majord...@freebsd.org
with "unsubscribe freebsd-current" in the body of the message

Reply via email to