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.11 by root, Sun Nov 4 16:52:52 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
37#ifndef EV_EMBED
36#include "event.h" 38# include "event.h"
39#endif
37 40
38#if EV_MULTIPLICITY 41#if EV_MULTIPLICITY
39# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base 42# define dLOOPev struct ev_loop *loop = (struct ev_loop *)ev->ev_base
40# define dLOOPbase struct ev_loop *loop = (struct ev_loop *)base 43# define dLOOPbase struct ev_loop *loop = (struct ev_loop *)base
41#else 44#else
47struct event_base 50struct event_base
48{ 51{
49 int dummy; 52 int dummy;
50}; 53};
51 54
52static struct event_base x_base, *x_cur; 55static struct event_base *x_cur;
53 56
54static void 57static void
55tv_set (struct timeval *tv, ev_tstamp at) 58tv_set (struct timeval *tv, ev_tstamp at)
56{ 59{
57 tv->tv_sec = (long)at; 60 tv->tv_sec = (long)at;
80} 83}
81 84
82void *event_init (void) 85void *event_init (void)
83{ 86{
84#if EV_MULTIPLICITY 87#if EV_MULTIPLICITY
88 if (x_cur)
85 x_cur = (struct event_base *)ev_loop_new (EVMETHOD_AUTO); 89 x_cur = (struct event_base *)ev_loop_new (EVMETHOD_AUTO);
90 else
91 x_cur = ev_default_loop (EVMETHOD_AUTO);
86#else 92#else
87 x_cur = &x_base; 93 assert (("multiple event bases not supported when not compiled with EV_MULTIPLICITY", !x_cur));
94
95 x_cur = (struct event_base *)ev_default_loop (EVMETHOD_AUTO);
88#endif 96#endif
89 97
90 return x_cur; 98 return x_cur;
91} 99}
92 100
102int event_dispatch (void) 110int event_dispatch (void)
103{ 111{
104 return event_base_dispatch (x_cur); 112 return event_base_dispatch (x_cur);
105} 113}
106 114
107#ifdef EV_STANDALONE 115#ifdef EV_EMBED
108void event_set_log_callback (event_log_cb cb) 116void event_set_log_callback (event_log_cb cb)
109{ 117{
110 /* nop */ 118 /* nop */
111} 119}
112#endif 120#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines