- 27 Feb, 2016 4 commits
-
-
William Ahern authored
-
git://github.com/nmathewson/timeoutWilliam Ahern authored
Merge branch 'fixing_intervals' of git://github.com/nmathewson/timeout into nmathewson-fixing_intervals
-
William Ahern authored
add Lua module, move noise into subdirectories, and make build portable by only using POSIX make syntax and semantics
-
William Ahern authored
-
- 26 Feb, 2016 3 commits
-
-
Nick Mathewson authored
Also, make them check the required invariants for to->expires after timeout_readd(). Also, actually use the different timeout values in the main() function (whoops).
-
Nick Mathewson authored
William Ahern tells me that the intent here is that timeout_readd() should always reschedule the timeout at the first time in the future that is an even multiple of to->interval, as if we had called: do { to->expires += to->interval; } while (to->expires <= T->curtime); But of course, that's not efficient. The implementation strategy used in this patch simplifies the calculation down to a single % operation, plus a few additions and subtractions. To verify the correctness of the formula used here, note first that 0 <= r < to->interval, and so 0 < to->interval - r <= to->interval. Since expires' = curtime + (interval - r), curtime < expires' <= curtime + interval, and so the new expiration time is no more than one interval after curtime. Note second that since r = (curtime - expires) % interval, expires' = curtime + (interval - r), we have (expires' - expires) % interval = (curtime + (interval - r) - expires) % interval = (curtime - r - expires) % interval = (curtime - (curtime-expires) % interval - expires) % interval = (curtime - curtime + expires - expires) % interval = 0. And so the new expiration time is an even multiple of interval from the original expiration time. Since we have both properties we wanted, this formula should be right.
-
William Ahern authored
-
- 24 Feb, 2016 18 commits
-
-
William Ahern authored
-
-
William Ahern authored
-
William Ahern authored
-
-
William Ahern authored
rename timeouts_cursor to more terse timeouts_it bumb version numbers
-
Nick Mathewson authored
-
William Ahern authored
-
William Ahern authored
reorder statements in timeouts_get to make TIMEOUT_DISABLE_INTERVALS case simpler, removing need for macro accessors
-
git://github.com/nmathewson/timeoutWilliam Ahern authored
Merge branch 'optional_intervals' of git://github.com/nmathewson/timeout into nmathewson-optional_intervals
-
William Ahern authored
-
git://github.com/nmathewson/timeoutWilliam Ahern authored
Merge branch 'optional_timeout_ptr' of git://github.com/nmathewson/timeout into nmathewson-optional_timeout_ptr
-
William Ahern authored
-
William Ahern authored
-
git://github.com/nmathewson/timeoutWilliam Ahern authored
Merge branch 'timeout_foreach' of git://github.com/nmathewson/timeout into nmathewson-timeout_foreach
-
William Ahern authored
-
git://github.com/nmathewson/timeoutWilliam Ahern authored
Merge branch 'timeout_cb_override' of git://github.com/nmathewson/timeout into nmathewson-timeout_cb_override
-
William Ahern authored
-
- 23 Feb, 2016 5 commits
-
-
git://github.com/nmathewson/timeoutWilliam Ahern authored
Merge branch 'portable_bitops' of git://github.com/nmathewson/timeout into nmathewson-portable_bitops
-
William Ahern authored
-
William Ahern authored
-
William Ahern authored
-
William Ahern authored
-
- 22 Feb, 2016 4 commits
-
-
William Ahern authored
-
Nick Mathewson authored
According to the documentation, 32-bit x86 builds do not have the 64-bit _BitScan{Forward,Reverse}64 intrinsics.
-
Nick Mathewson authored
-
Nick Mathewson authored
Given these, we can remove the code to check for the zero case.
-
- 20 Feb, 2016 1 commit
-
-
Nick Mathewson authored
These currently cover most reachable lines and branches, except the case where malloc fails in timeouts_open(), the if() branch in timeouts_readd() (see issue #7) , and some failure cases in timeouts_check().
-
- 19 Feb, 2016 5 commits
-
-
Nick Mathewson authored
This patch includes an intrinsic implementation for these functions when the compiler is GCC, Clang, or MSVC--or if the compiler claims to be one of those. Otherwise, a naive implementation is used. Tests are included for all of these functions, which turned up a possible problem: according to the gcc documentation, __builtin_ctz and __builtin_clz give an undefined result when their inputs is zero. I was not able to persuade myself that we always called them with a nonzero argument.
-
Nick Mathewson authored
This field eats a pointer for every struct timeout, and it only exists in order to enable a set of APIs that omit the 'struct timeouts' object. For some applications, the convenience of these APIs is not worth the memory overhead. This patch makes it so that applications can disable those APIs, and save some memory, by defining TIMEOUT_DISABLE_RELATIVE_ACCESS at compile time.
-
Nick Mathewson authored
Some users only need plain timeouts. They shouldn't have to pay the overhead for a field they will never set. With this patch, they can define TIMEOUT_DISABLE_INTERVALS and turn off the feature at compile time.
-
Nick Mathewson authored
Libevent needed this, and I expect that others will too.
-
Nick Mathewson authored
I've found that frequently a void function and a pointer are either more or less than we want to attach to each timeout object. This patch makes it so that the user can define TIMEOUT_CB_OVERRIDE to indicate that they have included their own definition of struct timeout_cb.
-