ioloop.c revision 7013075e208bc7aa87257df7d9664c84c7c220f3
/*
ioloop.c : I/O loop
Copyright (c) 2002 Timo Sirainen
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
/* FIXME: inserting io is slow if there's lots of them. I should add a linked
list of priorities pointing to first item in the list with the priority. */
#include "lib.h"
#include "ioloop-internal.h"
time_t ioloop_time = 0;
struct timeval ioloop_timeval;
struct timezone ioloop_timezone;
{
int max_highest_fd;
break;
}
}
}
{
break;
}
else {
}
}
}
{
}
{
return io;
}
{
/* notify the real I/O handler */
/* check if we removed the highest fd */
}
{
/* remove from list */
else
}
{
struct timeout **t;
break;
}
*t = timeout;
}
inline static void
{
else {
}
/* we don't want microsecond accuracy or this function will be
called all the time - millisecond is more than enough */
}
}
void *context)
{
NULL : &ioloop_timeval);
return timeout;
}
{
}
{
struct timeout **t;
if (*t == timeout)
break;
}
}
{
return INT_MAX;
else {
}
}
/* no need to calculate the times again with this timeout */
return 0;
}
{
unsigned int t_id;
return;
if (t->destroyed) {
timeout_destroy(ioloop, t);
continue;
}
if (!t->run_now) {
if (!t->run_now)
break;
}
i_panic("Leaked a t_pop() call!");
}
}
{
}
{
}
{
}
{
}
{
/* initialize time */
return ioloop;
}
{
i_warning("I/O leak: %p (%d)",
}
}
}
}
/* ->prev won't work unless loops are destroyed in create order */
}