Browse Source

*** empty log message ***

master
Marc Alexander Lehmann 13 years ago
parent
commit
4e834d890e
4 changed files with 35 additions and 7 deletions
  1. +6
    -0
      ev.3
  2. +14
    -6
      ev.c
  3. +8
    -1
      ev.html
  4. +7
    -0
      ev.pod

+ 6
- 0
ev.3 View File

@ -2120,6 +2120,12 @@ defined to be \f(CW0\fR, then they are not.
If you need to shave off some kilobytes of code at the expense of some
speed, define this symbol to \f(CW1\fR. Currently only used for gcc to override
some inlining decisions, saves roughly 30% codesize of amd64.
.IP "\s-1EV_PID_HASHSIZE\s0" 4
.IX Item "EV_PID_HASHSIZE"
\&\f(CW\*(C`ev_child\*(C'\fR watchers use a small hash table to distribute workload by
pid. The default size is \f(CW16\fR (or \f(CW1\fR with \f(CW\*(C`EV_MINIMAL\*(C'\fR), usually more
than enough. If you need to manage thousands of children you might want to
increase this value.
.IP "\s-1EV_COMMON\s0" 4
.IX Item "EV_COMMON"
By default, all watchers have a \f(CW\*(C`void *data\*(C'\fR member. By redefining


+ 14
- 6
ev.c View File

@ -158,6 +158,14 @@ extern "C" {
# define EV_USE_PORT 0
#endif
#ifndef EV_PID_HASHSIZE
# if EV_MINIMAL
# define EV_PID_HASHSIZE 1
# else
# define EV_PID_HASHSIZE 16
# endif
#endif
/**/
#ifndef CLOCK_MONOTONIC
@ -178,7 +186,6 @@ extern "C" {
#define MIN_TIMEJUMP 1. /* minimum timejump that gets detected (if monotonic clock available) */
#define MAX_BLOCKTIME 59.743 /* never wait longer than this time (to detect time jumps) */
#define PID_HASHSIZE 16 /* size of pid hash table, must be power of two */
/*#define CLEANUP_INTERVAL (MAX_BLOCKTIME * 5.) /* how often to try to free memory and re-check fds */
#ifdef EV_H
@ -711,7 +718,7 @@ siginit (EV_P)
/*****************************************************************************/
static ev_child *childs [PID_HASHSIZE];
static ev_child *childs [EV_PID_HASHSIZE];
#ifndef _WIN32
@ -722,7 +729,7 @@ child_reap (EV_P_ ev_signal *sw, int chain, int pid, int status)
{
ev_child *w;
for (w = (ev_child *)childs [chain & (PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next)
for (w = (ev_child *)childs [chain & (EV_PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next)
if (w->pid == pid || !w->pid)
{
ev_priority (w) = ev_priority (sw); /* need to do it *now* */
@ -753,7 +760,8 @@ childcb (EV_P_ ev_signal *sw, int revents)
ev_feed_event (EV_A_ (W)sw, EV_SIGNAL);
child_reap (EV_A_ sw, pid, pid, status);
child_reap (EV_A_ sw, 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */
if (EV_PID_HASHSIZE > 1)
child_reap (EV_A_ sw, 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */
}
#endif
@ -1627,7 +1635,7 @@ ev_child_start (EV_P_ ev_child *w)
return;
ev_start (EV_A_ (W)w, 1);
wlist_add ((WL *)&childs [w->pid & (PID_HASHSIZE - 1)], (WL)w);
wlist_add ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w);
}
void
@ -1637,7 +1645,7 @@ ev_child_stop (EV_P_ ev_child *w)
if (expect_false (!ev_is_active (w)))
return;
wlist_del ((WL *)&childs [w->pid & (PID_HASHSIZE - 1)], (WL)w);
wlist_del ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w);
ev_stop (EV_A_ (W)w);
}


+ 8
- 1
ev.html View File

@ -6,7 +6,7 @@
<meta name="description" content="Pod documentation for libev" />
<meta name="inputfile" content="&lt;standard input&gt;" />
<meta name="outputfile" content="&lt;standard output&gt;" />
<meta name="created" content="Tue Nov 27 11:59:06 2007" />
<meta name="created" content="Tue Nov 27 20:23:27 2007" />
<meta name="generator" content="Pod::Xhtml 1.57" />
<link rel="stylesheet" href="http://res.tst.eu/pod.css"/></head>
<body>
@ -1997,6 +1997,13 @@ defined to be <code>0</code>, then they are not.</p>
<p>If you need to shave off some kilobytes of code at the expense of some
speed, define this symbol to <code>1</code>. Currently only used for gcc to override
some inlining decisions, saves roughly 30% codesize of amd64.</p>
</dd>
<dt>EV_PID_HASHSIZE</dt>
<dd>
<p><code>ev_child</code> watchers use a small hash table to distribute workload by
pid. The default size is <code>16</code> (or <code>1</code> with <code>EV_MINIMAL</code>), usually more
than enough. If you need to manage thousands of children you might want to
increase this value.</p>
</dd>
<dt>EV_COMMON</dt>
<dd>


+ 7
- 0
ev.pod View File

@ -1999,6 +1999,13 @@ If you need to shave off some kilobytes of code at the expense of some
speed, define this symbol to C<1>. Currently only used for gcc to override
some inlining decisions, saves roughly 30% codesize of amd64.
=item EV_PID_HASHSIZE
C<ev_child> watchers use a small hash table to distribute workload by
pid. The default size is C<16> (or C<1> with C<EV_MINIMAL>), usually more
than enough. If you need to manage thousands of children you might want to
increase this value.
=item EV_COMMON
By default, all watchers have a C<void *data> member. By redefining


Loading…
Cancel
Save