o Fix a memory error when freeing a thread-enabled event base with registered events. (Spotted by Joachim Bauch.)
o Try to contain degree of failure when running on a win32 version so heavily firewalled that we can't fake a socketpair.
o Activate fd events in a pseudorandom order with O(N) backends, so that we don't systematically favor low fds (select) or earlier-added fds (poll, win32).
+ o Replace some read()/write() instances with send()/recv() to work properly
+ on win32.
Changes in 2.0.1-alpha:
long idx = (long) arg, widx = idx + 1;
u_char ch;
- count += read(fd, &ch, sizeof(ch));
+ count += recv(fd, &ch, sizeof(ch), 0);
if (writes) {
if (widx >= num_pipes)
widx -= num_pipes;
- write(pipes[2 * widx + 1], "e", 1);
+ send(pipes[2 * widx + 1], "e", 1, 0);
writes--;
fired++;
}
space = num_pipes / num_active;
space = space * 2;
for (i = 0; i < num_active; i++, fired++)
- write(pipes[i * space + 1], "e", 1);
+ send(pipes[i * space + 1], "e", 1, 0);
count = 0;
writes = num_writes;
char ch;
long idx = (long) arg;
- read(fd, &ch, sizeof(ch));
+ recv(fd, &ch, sizeof(ch), 0);
if (idx >= 0)
- write(idx, "e", 1);
+ send(idx, "e", 1, 0);
fired++;
}
fired = 0;
/* kick everything off with a single write */
- write(pipes[1], "e", 1);
+ send(pipes[1], "e", 1, 0);
event_dispatch();
char buf;
int len;
- len = read(fd, &buf, sizeof(buf));
+ len = recv(fd, &buf, sizeof(buf), 0);
/*printf("%s: %s %d%s\n", __func__, event & EV_ET ? "etread" : "read",
len, len ? "" : " - means EOF");
called = was_et = 0;
- write(pair[0], test, strlen(test)+1);
+ send(pair[0], test, strlen(test)+1, 0);
shutdown(pair[0], SHUT_WR);
/* Initalize the event library */
char buf[256];
int len;
- len = read(fd, buf, sizeof(buf));
+ len = recv(fd, buf, sizeof(buf), 0);
printf("%s: read %d%s\n", __func__,
len, len ? "" : " - means EOF");
return (1);
- write(pair[0], test, strlen(test)+1);
+ send(pair[0], test, strlen(test)+1, 0);
shutdown(pair[0], SHUT_WR);
/* Initalize the event library */
const char *test = "test string";
int len;
- len = write(fd, test, strlen(test) + 1);
+ len = send(fd, test, strlen(test) + 1, 0);
printf("%s: write %d%s\n", __func__,
len, len ? "" : " - means EOF");