*** empty log message ***

master
Marc Alexander Lehmann 2008-04-06 14:34:50 +00:00
parent bcf2d94e34
commit 86cfc4c95e
4 changed files with 48 additions and 12 deletions

View File

@ -3,6 +3,10 @@ Revision history for libev, a high-performance and full-featured event loop.
- added linux eventfd support.
- try to autodetect epoll and inotify support
by libc header version if not using autoconf.
- new symbols: EV_DEFAULT_UC and EV_DEFAULT_UC_.
- declare functions defined in ev.h as inline if
C99 or gcc are available.
- enable inlining with gcc versions 2 and 3.
3.2 Wed Apr 2 17:11:19 CEST 2008
- fix a 64 bit overflow issue in the select backend,

2
ev.c
View File

@ -302,7 +302,7 @@ int eventfd (unsigned int initval, int flags);
#else
# define expect(expr,value) (expr)
# define noinline
# if __STDC_VERSION__ < 199901L
# if __STDC_VERSION__ < 199901L && __GNUC__ < 2
# define inline
# endif
#endif

44
ev.h
View File

@ -100,6 +100,8 @@ struct ev_loop;
# define EV_P_ EV_P,
# define EV_A loop
# define EV_A_ EV_A,
# define EV_DEFAULT_UC ev_default_loop_uc ()
# define EV_DEFAULT_UC_ EV_DEFAULT_UC,
# define EV_DEFAULT ev_default_loop (0)
# define EV_DEFAULT_ EV_DEFAULT,
#else
@ -109,10 +111,19 @@ struct ev_loop;
# define EV_A_
# define EV_DEFAULT
# define EV_DEFAULT_
# define EV_DEFAULT_UC
# define EV_DEFAULT_UC_
# undef EV_EMBED_ENABLE
#endif
#if __STDC_VERSION__ >= 199901L || __GNUC__ >= 3
# define EV_INLINE static inline
#else
# define EV_INLINE static
#endif
/*****************************************************************************/
/* eventmask, revents, events... */
#define EV_UNDEF -1L /* guaranteed to be invalid */
#define EV_NONE 0x00L /* no events */
@ -400,20 +411,31 @@ void ev_set_allocator (void *(*cb)(void *ptr, long size));
void ev_set_syserr_cb (void (*cb)(const char *msg));
# if EV_MULTIPLICITY
/* the default loop is the only one that handles signals and child watchers */
/* you can call this as often as you like */
static struct ev_loop *
ev_default_loop (unsigned int flags)
EV_INLINE struct ev_loop *
ev_default_loop_uc (void)
{
extern struct ev_loop *ev_default_loop_ptr;
extern struct ev_loop *ev_default_loop_init (unsigned int flags);
if (!ev_default_loop_ptr)
ev_default_loop_init (flags);
return ev_default_loop_ptr;
}
/* the default loop is the only one that handles signals and child watchers */
/* you can call this as often as you like */
EV_INLINE struct ev_loop *
ev_default_loop (unsigned int flags)
{
struct ev_loop *loop = ev_default_loop_uc ();
if (!loop)
{
extern struct ev_loop *ev_default_loop_init (unsigned int flags);
loop = ev_default_loop_init (flags);
}
return loop;
}
/* create and destroy alternative loops that don't handle signals */
struct ev_loop *ev_loop_new (unsigned int flags);
void ev_loop_destroy (EV_P);
@ -425,7 +447,7 @@ ev_tstamp ev_now (EV_P); /* time w.r.t. timers and the eventloop, updated after
int ev_default_loop (unsigned int flags); /* returns true when successful */
static ev_tstamp
EV_INLINE ev_tstamp
ev_now (void)
{
extern ev_tstamp ev_rt_now;
@ -434,7 +456,7 @@ ev_now (void)
}
# endif
static int
EV_INLINE int
ev_is_default_loop (EV_P)
{
#if EV_MULTIPLICITY

10
ev.pod
View File

@ -2635,6 +2635,16 @@ suitable for use with C<EV_A>.
Similar to the other two macros, this gives you the value of the default
loop, if multiple loops are supported ("ev loop default").
=item C<EV_DEFAULT_UC>, C<EV_DEFAULT_UC_>
Usage identical to C<EV_DEFAULT> and C<EV_DEFAULT_>, but requires that the
default loop has been initialised (C<UC> == unchecked). Their behaviour
is undefined when the default loop has not been initialised by a previous
execution of C<EV_DEFAULT>, C<EV_DEFAULT_> or C<ev_default_init (...)>.
It is often prudent to use C<EV_DEFAULT> when initialising the first
watcher in a function but use C<EV_DEFAULT_UC> afterwards.
=back
Example: Declare and initialise a check watcher, utilising the above