ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/event.c
(Generate patch)

Comparing libev/event.c (file contents):
Revision 1.9 by root, Sun Nov 4 00:24:17 2007 UTC vs.
Revision 1.10 by root, Sun Nov 4 15:58:50 2007 UTC

30 */ 30 */
31 31
32#include <stddef.h> 32#include <stddef.h>
33#include <stdlib.h> 33#include <stdlib.h>
34#include <sys/time.h> 34#include <sys/time.h>
35#include <assert.h>
35 36
36#include "event.h" 37#include "event.h"
37 38
38#if EV_MULTIPLICITY 39#if EV_MULTIPLICITY
39# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base 40# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base
47struct event_base 48struct event_base
48{ 49{
49 int dummy; 50 int dummy;
50}; 51};
51 52
52static struct event_base x_base, *x_cur; 53static struct event_base *x_cur;
53 54
54static void 55static void
55tv_set (struct timeval *tv, ev_tstamp at) 56tv_set (struct timeval *tv, ev_tstamp at)
56{ 57{
57 tv->tv_sec = (long)at; 58 tv->tv_sec = (long)at;
80} 81}
81 82
82void *event_init (void) 83void *event_init (void)
83{ 84{
84#if EV_MULTIPLICITY 85#if EV_MULTIPLICITY
86 if (x_cur)
85 x_cur = (struct event_base *)ev_loop_new (EVMETHOD_AUTO); 87 x_cur = (struct event_base *)ev_loop_new (EVMETHOD_AUTO);
88 else
89 x_cur = ev_default_loop (EVMETHOD_AUTO);
86#else 90#else
87 x_cur = &x_base; 91 assert (("multiple event bases not supported when not compiled with EV_MULTIPLICITY", !x_cur));
92
93 x_cur = (struct event_base *)ev_default_loop (EVMETHOD_AUTO);
88#endif 94#endif
89 95
90 return x_cur; 96 return x_cur;
91} 97}
92 98

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines