~ubuntu-branches/ubuntu/wily/dovecot/wily

« back to all changes in this revision

Viewing changes to src/lib/ioloop.c

  • Committer: Package Import Robot
  • Author(s): Jaldhar H. Vyas
  • Date: 2013-09-09 00:57:32 UTC
  • mfrom: (1.13.11)
  • mto: (4.8.5 experimental) (1.16.1)
  • mto: This revision was merged to the branch mainline in revision 97.
  • Revision ID: package-import@ubuntu.com-20130909005732-dn1eell8srqbhh0e
Tags: upstream-2.2.5
ImportĀ upstreamĀ versionĀ 2.2.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (c) 2002-2012 Dovecot authors, see the included COPYING file */
 
1
/* Copyright (c) 2002-2013 Dovecot authors, see the included COPYING file */
2
2
 
3
3
#include "lib.h"
4
4
#include "array.h"
165
165
        return timeout;
166
166
}
167
167
 
 
168
#undef timeout_add_short
 
169
struct timeout *
 
170
timeout_add_short(unsigned int msecs, unsigned int source_linenum,
 
171
                  timeout_callback_t *callback, void *context)
 
172
{
 
173
        return timeout_add(msecs, source_linenum, callback, context);
 
174
}
 
175
 
168
176
static void timeout_free(struct timeout *timeout)
169
177
{
170
178
        if (timeout->ctx != NULL)
181
189
        timeout_free(timeout);
182
190
}
183
191
 
184
 
static void
 
192
static void ATTR_NULL(2)
185
193
timeout_reset_timeval(struct timeout *timeout, struct timeval *tv_now)
186
194
{
187
195
        timeout_update_next(timeout, tv_now);
188
 
        if (timeout->msecs == 0) {
 
196
        if (timeout->msecs <= 1) {
189
197
                /* if we came here from io_loop_handle_timeouts(),
190
198
                   next_run must be larger than tv_now or we could go to
191
199
                   infinite loop. +1000 to get 1 ms further, another +1000 to
652
660
        timeout_remove(_timeout);
653
661
        return new_to;
654
662
}
 
663
 
 
664
bool io_loop_have_ios(struct ioloop *ioloop)
 
665
{
 
666
        return ioloop->io_files != NULL;
 
667
}
 
668
 
 
669
bool io_loop_have_immediate_timeouts(struct ioloop *ioloop)
 
670
{
 
671
        struct timeval tv;
 
672
 
 
673
        return io_loop_get_wait_time(ioloop, &tv) == 0;
 
674
}