Browse Source

*** empty log message ***

master
Marc Alexander Lehmann 14 years ago
parent
commit
7a8a81bbe7
  1. 3
      Changes
  2. 2
      Makefile.am
  3. 16
      ev++.h
  4. 22
      ev.c
  5. 7
      ev.h
  6. 8
      ev.pod

3
Changes

@ -1,8 +1,11 @@
Revision history for libev, a high-performance and full-featured event loop
- API/ABI bump to version 3.0.
- ev++.h includes "ev.h" by default now, not <ev.h>.
- slightly improved documentation.
- speed up signal detection after a fork.
- only optionally return trace status changed in ev_child
watchers.
2.01 Tue Dec 25 08:04:41 CET 2007
- separate Changes file.

2
Makefile.am

@ -1,6 +1,6 @@
AUTOMAKE_OPTIONS = foreign no-dependencies
VERSION_INFO = 2:0
VERSION_INFO = 3:0
EXTRA_DIST = LICENSE Changes libev.m4 autogen.sh \
ev_vars.h ev_wrap.h \

16
ev++.h

@ -159,22 +159,22 @@ namespace ev {
}
#if EV_MULTIPLICITY
bool operator== (struct ev_loop *other) const throw ()
bool operator == (struct ev_loop *other) const throw ()
{
return this->EV_AX == other;
}
bool operator!= (struct ev_loop *other) const throw ()
bool operator != (struct ev_loop *other) const throw ()
{
return ! (*this == other);
}
bool operator== (const struct ev_loop *other) const throw ()
bool operator == (const struct ev_loop *other) const throw ()
{
return this->EV_AX == other;
}
bool operator!= (const struct ev_loop *other) const throw ()
bool operator != (const struct ev_loop *other) const throw ()
{
return (*this == other);
}
@ -697,17 +697,17 @@ namespace ev {
EV_END_WATCHER (sig, signal)
EV_BEGIN_WATCHER (child, child)
void set (int pid) throw ()
void set (int pid, int trace = 0) throw ()
{
int active = is_active ();
if (active) stop ();
ev_child_set (static_cast<ev_child *>(this), pid);
ev_child_set (static_cast<ev_child *>(this), pid, trace);
if (active) start ();
}
void start (int pid) throw ()
void start (int pid, int trace = 0) throw ()
{
set (pid);
set (pid, trace);
start ();
}
EV_END_WATCHER (child, child)

22
ev.c

@ -869,19 +869,27 @@ static WL childs [EV_PID_HASHSIZE];
static ev_signal childev;
#ifndef WIFCONTINUED
# define WIFCONTINUED(status) 0
#endif
void inline_speed
child_reap (EV_P_ ev_signal *sw, int chain, int pid, int status)
{
ev_child *w;
int traced = WIFSTOPPED (status) || WIFCONTINUED (status);
for (w = (ev_child *)childs [chain & (EV_PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next)
if (w->pid == pid || !w->pid)
{
ev_set_priority (w, ev_priority (sw)); /* need to do it *now* */
w->rpid = pid;
w->rstatus = status;
ev_feed_event (EV_A_ (W)w, EV_CHILD);
}
{
if ((w->pid == pid || !w->pid)
&& (!traced || (w->flags & 1)))
{
ev_set_priority (w, ev_priority (sw)); /* need to do it *now* */
w->rpid = pid;
w->rstatus = status;
ev_feed_event (EV_A_ (W)w, EV_CHILD);
}
}
}
#ifndef WCONTINUED

7
ev.h

@ -130,7 +130,7 @@ struct ev_loop;
# define EV_PROTOTYPES 1
#endif
#define EV_VERSION_MAJOR 2
#define EV_VERSION_MAJOR 3
#define EV_VERSION_MINOR 0
#ifndef EV_CB_DECLARE
@ -227,6 +227,7 @@ typedef struct ev_child
{
EV_WATCHER_LIST (ev_child)
int flags; /* private */
int pid; /* ro */
int rpid; /* rw, holds the received pid */
int rstatus; /* rw, holds the exit status, use the macros from sys/wait.h */
@ -457,7 +458,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
#define ev_timer_set(ev,after_,repeat_) do { (ev)->at = (after_); (ev)->repeat = (repeat_); } while (0)
#define ev_periodic_set(ev,ofs_,ival_,res_) do { (ev)->offset = (ofs_); (ev)->interval = (ival_); (ev)->reschedule_cb= (res_); } while (0)
#define ev_signal_set(ev,signum_) do { (ev)->signum = (signum_); } while (0)
#define ev_child_set(ev,pid_) do { (ev)->pid = (pid_); } while (0)
#define ev_child_set(ev,pid_,trace_) do { (ev)->pid = (pid_); (ev)->flags = !!(trace_); } while (0)
#define ev_stat_set(ev,path_,interval_) do { (ev)->path = (path_); (ev)->interval = (interval_); (ev)->wd = -2; } while (0)
#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 */
@ -469,7 +470,7 @@ void ev_once (EV_P_ int fd, int events, ev_tstamp timeout, void (*cb)(int revent
#define ev_timer_init(ev,cb,after,repeat) do { ev_init ((ev), (cb)); ev_timer_set ((ev),(after),(repeat)); } while (0)
#define ev_periodic_init(ev,cb,at,ival,res) do { ev_init ((ev), (cb)); ev_periodic_set ((ev),(at),(ival),(res)); } while (0)
#define ev_signal_init(ev,cb,signum) do { ev_init ((ev), (cb)); ev_signal_set ((ev), (signum)); } while (0)
#define ev_child_init(ev,cb,pid) do { ev_init ((ev), (cb)); ev_child_set ((ev),(pid)); } while (0)
#define ev_child_init(ev,cb,pid,trace) do { ev_init ((ev), (cb)); ev_child_set ((ev),(pid),(trace)); } while (0)
#define ev_stat_init(ev,cb,path,interval) do { ev_init ((ev), (cb)); ev_stat_set ((ev),(path),(interval)); } while (0)
#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)

8
ev.pod

@ -1440,16 +1440,18 @@ some child status changes (most typically when a child of yours dies).
=over 4
=item ev_child_init (ev_child *, callback, int pid)
=item ev_child_init (ev_child *, callback, int pid, int trace)
=item ev_child_set (ev_child *, int pid)
=item ev_child_set (ev_child *, int pid, int trace)
Configures the watcher to wait for status changes of process C<pid> (or
I<any> process if C<pid> is specified as C<0>). The callback can look
at the C<rstatus> member of the C<ev_child> watcher structure to see
the status word (use the macros from C<sys/wait.h> and see your systems
C<waitpid> documentation). The C<rpid> member contains the pid of the
process causing the status change.
process causing the status change. C<trace> must be either C<0> (only
activate the watcher when the process terminates) or C<1> (additionally
activate the watcher when the process is stopped or continued).
=item int pid [read-only]

Loading…
Cancel
Save