*** empty log message ***

master
Marc Alexander Lehmann 2007-12-20 07:12:57 +00:00
parent 5eee1430c9
commit 7b5a9d835c
5 changed files with 92 additions and 13 deletions

8
ev.c
View File

@ -2184,7 +2184,7 @@ ev_check_stop (EV_P_ ev_check *w)
void noinline
ev_embed_sweep (EV_P_ ev_embed *w)
{
ev_loop (w->loop, EVLOOP_NONBLOCK);
ev_loop (w->other, EVLOOP_NONBLOCK);
}
static void
@ -2205,7 +2205,7 @@ ev_embed_start (EV_P_ ev_embed *w)
return;
{
struct ev_loop *loop = w->loop;
struct ev_loop *loop = w->other;
assert (("loop to be embedded is not embeddable", backend & ev_embeddable_backends ()));
ev_io_init (&w->io, embed_cb, backend_fd, EV_READ);
}
@ -2322,6 +2322,10 @@ ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revents, vo
}
}
#if EV_MULTIPLICITY
#include "ev_wrap.h"
#endif
#ifdef __cplusplus
}
#endif

6
ev.h
View File

@ -286,7 +286,7 @@ typedef struct ev_embed
EV_WATCHER (ev_embed)
ev_io io; /* private */
struct ev_loop *loop; /* ro */
struct ev_loop *other; /* ro */
} ev_embed;
#endif
@ -442,7 +442,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
#define ev_idle_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_prepare_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_check_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_embed_set(ev,loop_) do { (ev)->loop = (loop_); } while (0)
#define ev_embed_set(ev,other_) do { (ev)->other = (other_); } while (0)
#define ev_fork_set(ev) /* nop, yes, this is a serious in-joke */
#define ev_io_init(ev,cb,fd,events) do { ev_init ((ev), (cb)); ev_io_set ((ev),(fd),(events)); } while (0)
@ -454,7 +454,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
#define ev_idle_init(ev,cb) do { ev_init ((ev), (cb)); ev_idle_set ((ev)); } while (0)
#define ev_prepare_init(ev,cb) do { ev_init ((ev), (cb)); ev_prepare_set ((ev)); } while (0)
#define ev_check_init(ev,cb) do { ev_init ((ev), (cb)); ev_check_set ((ev)); } while (0)
#define ev_embed_init(ev,cb,loop) do { ev_init ((ev), (cb)); ev_embed_set ((ev),(loop)); } while (0)
#define ev_embed_init(ev,cb,other) do { ev_init ((ev), (cb)); ev_embed_set ((ev),(other)); } while (0)
#define ev_fork_init(ev,cb) do { ev_init ((ev), (cb)); ev_fork_set ((ev)); } while (0)
#define ev_is_pending(ev) (0 + ((ev_watcher *)(void *)(ev))->pending) /* ro, true when watcher is waiting for callback invocation */

4
ev.pod
View File

@ -1793,7 +1793,7 @@ Make a single, non-blocking sweep over the embedded loop. This works
similarly to C<ev_loop (embedded_loop, EVLOOP_NONBLOCK)>, but in the most
apropriate way for embedded loops.
=item struct ev_loop *loop [read-only]
=item struct ev_loop *other [read-only]
The embedded event loop.
@ -2142,7 +2142,7 @@ applications. Examples of applications that embed it include the Deliantra
Game Server, the EV perl module, the GNU Virtual Private Ethernet (gvpe)
and rxvt-unicode.
The goal is to enable you to just copy the neecssary files into your
The goal is to enable you to just copy the necessary files into your
source directory without having to change even a single line in them, so
you can easily upgrade by simply copying (or having a checked-out copy of
libev somewhere in your source tree).

View File

@ -1,10 +1,12 @@
/* DO NOT EDIT, automatically generated by update_ev_wrap */
#ifndef EV_WRAP_H
#define EV_WRAP_H
#define now_floor ((loop)->now_floor)
#define mn_now ((loop)->mn_now)
#define rtmn_diff ((loop)->rtmn_diff)
#define backend ((loop)->backend)
#define activecnt ((loop)->activecnt)
#define loop_count ((loop)->loop_count);
#define loop_count ((loop)->loop_count)
#define backend_fudge ((loop)->backend_fudge)
#define backend_modify ((loop)->backend_modify)
#define backend_poll ((loop)->backend_poll)
@ -60,3 +62,67 @@
#define fs_fd ((loop)->fs_fd)
#define fs_w ((loop)->fs_w)
#define fs_hash ((loop)->fs_hash)
#else
#undef EV_WRAP_H
#undef now_floor
#undef mn_now
#undef rtmn_diff
#undef backend
#undef activecnt
#undef loop_count
#undef backend_fudge
#undef backend_modify
#undef backend_poll
#undef backend_fd
#undef curpid
#undef postfork
#undef vec_ri
#undef vec_ro
#undef vec_wi
#undef vec_wo
#undef vec_max
#undef polls
#undef pollmax
#undef pollcnt
#undef pollidxs
#undef pollidxmax
#undef epoll_events
#undef epoll_eventmax
#undef kqueue_changes
#undef kqueue_changemax
#undef kqueue_changecnt
#undef kqueue_events
#undef kqueue_eventmax
#undef port_events
#undef port_eventmax
#undef anfds
#undef anfdmax
#undef pendings
#undef pendingmax
#undef pendingcnt
#undef fdchanges
#undef fdchangemax
#undef fdchangecnt
#undef timers
#undef timermax
#undef timercnt
#undef periodics
#undef periodicmax
#undef periodiccnt
#undef idles
#undef idlemax
#undef idlecnt
#undef idleall
#undef prepares
#undef preparemax
#undef preparecnt
#undef checks
#undef checkmax
#undef checkcnt
#undef forks
#undef forkmax
#undef forkcnt
#undef fs_fd
#undef fs_w
#undef fs_hash
#endif

View File

@ -1,10 +1,19 @@
#!/bin/sh
(
echo '#define VAR(name,decl) define name ((loop)->name)'
echo '#define VAR(name,decl) name'
echo '#define EV_GENWRAP 1'
cat ev_vars.h
) | cc -E -o - - | sed -n -e 's/define/#define/p' | (
echo "/* DO NOT EDIT, automatically generated by update_ev_wrap */"
cat
) > ev_wrap.h
) | cc -E -o - - | perl -ne '
while (<>) {
push @syms, $1 if /(^\w+)/;
}
print "/* DO NOT EDIT, automatically generated by update_ev_wrap */\n",
"#ifndef EV_WRAP_H\n",
"#define EV_WRAP_H\n",
(map "#define $_ ((loop)->$_)\n", @syms),
"#else\n",
"#undef EV_WRAP_H\n",
(map "#undef $_\n", @syms),
"#endif\n";
' >ev_wrap.h