[Top][All Lists]

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

[lwip-devel] [bug #19167] tcp timeout handler can cause crash being invo

From: Dmitry Potapov
Subject: [lwip-devel] [bug #19167] tcp timeout handler can cause crash being invoked by sys_sem_wait()
Date: Wed, 28 Feb 2007 11:45:20 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20070216 Firefox/

Follow-up Comment #4, bug #19167 (project lwip):

Using of timestamps instead of time-delta does NOT require 64-bit.

/* timestamp_t value in milliseconds taken by module 2^32,
   so after 0xFFFFFFFF should be 0. */
typedef u32_t timestamp_t;
typedef s32_t timediff_t;

Now we need to define TIMESTAMP_DIFF macro that calculates the difference
between two timestamp_t values taken into account overflow and return it as
timediff_t, and TIMESTAMP_ADD which adds some timeout value to the given

Practically all modern processors use two's complement to represent signed
integers. So you can define them as

#define TIMESTAMP_DIFF(t1, t2) ((timediff_t)((t1) - (t2)))
#define TIMESTAMP_ADD(timestamp, timeout) \

then you can write

timediff_t timeout = TIMESTAMP_DIFF(timeouts->next->expires,
if (timeout > 0)
        sys_arch_mbox_fetch(mbox, msg, timeout)


Reply to this item at:


  Message sent via/by Savannah

reply via email to

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