X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=libevent%2Fevent-internal.h;h=1798b702a1034aa050eded48c97ccfae80bfc63e;hp=e3da33da724ed8ac21f68b30931ee00682d19e3e;hb=3a84db87064922ad10ac10cc1d6833380e575995;hpb=5ab4f0463c00263b3d842f1e1a3648ecf35b4d65 diff --git a/libevent/event-internal.h b/libevent/event-internal.h index e3da33da..1798b702 100644 --- a/libevent/event-internal.h +++ b/libevent/event-internal.h @@ -1,6 +1,6 @@ /* * Copyright (c) 2000-2007 Niels Provos - * Copyright (c) 2007-2010 Niels Provos and Nick Mathewson + * Copyright (c) 2007-2012 Niels Provos and Nick Mathewson * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,6 +32,7 @@ extern "C" { #endif #include "event2/event-config.h" +#include #include #include "event2/event_struct.h" #include "minheap-internal.h" @@ -145,6 +146,9 @@ struct common_timeout_list { struct event_base *base; }; +/** Mask used to get the real tv_usec value from a common timeout. */ +#define COMMON_TIMEOUT_MICROSECONDS_MASK 0x000fffff + struct event_change; /* List of 'changes' since the last call to eventop.dispatch. Only maintained @@ -235,9 +239,18 @@ struct event_base { /** Priority queue of events with timeouts. */ struct min_heap timeheap; - /** Stored timeval: used to avoid calling gettimeofday too often. */ + /** Stored timeval: used to avoid calling gettimeofday/clock_gettime + * too often. */ struct timeval tv_cache; +#if defined(_EVENT_HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) + /** Difference between internal time (maybe from clock_gettime) and + * gettimeofday. */ + struct timeval tv_clock_diff; + /** Second in which we last updated tv_clock_diff, in monotonic time. */ + time_t last_updated_clock_diff; +#endif + #ifndef _EVENT_DISABLE_THREAD_SUPPORT /* threading support */ /** The thread currently running the event_loop for this base */ @@ -303,10 +316,12 @@ struct event_config { #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) #endif +#ifndef TAILQ_FOREACH #define TAILQ_FOREACH(var, head, field) \ for ((var) = TAILQ_FIRST(head); \ (var) != TAILQ_END(head); \ (var) = TAILQ_NEXT(var, field)) +#endif #ifndef TAILQ_INSERT_BEFORE #define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ @@ -325,12 +340,21 @@ int _evsig_set_handler(struct event_base *base, int evsignal, void (*fn)(int)); int _evsig_restore_handler(struct event_base *base, int evsignal); + void event_active_nolock(struct event *ev, int res, short count); /* FIXME document. */ void event_base_add_virtual(struct event_base *base); void event_base_del_virtual(struct event_base *base); +/** For debugging: unless assertions are disabled, verify the referential + integrity of the internal data structures of 'base'. This operation can + be expensive. + + Returns on success; aborts on failure. +*/ +void event_base_assert_ok(struct event_base *base); + #ifdef __cplusplus } #endif