mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
from trunk: Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
svn:r683
This commit is contained in:
parent
aab6b84cc2
commit
d136059826
@ -1,6 +1,7 @@
|
|||||||
Changes in 1.4.3-stable:
|
Changes in 1.4.3-stable:
|
||||||
o include Content-Length in reply for HTTP/1.0 requests with keep-alive
|
o include Content-Length in reply for HTTP/1.0 requests with keep-alive
|
||||||
o Patch from Tani Hosokawa: make some functions in http.c threadsafe.
|
o Patch from Tani Hosokawa: make some functions in http.c threadsafe.
|
||||||
|
o Do not free the kqop file descriptor in other processes, also allow it to be 0; from Andrei Nigmatulin
|
||||||
|
|
||||||
Changes in 1.4.2-rc:
|
Changes in 1.4.2-rc:
|
||||||
o remove pending timeouts on event_base_free()
|
o remove pending timeouts on event_base_free()
|
||||||
|
5
kqueue.c
5
kqueue.c
@ -72,6 +72,7 @@ struct kqop {
|
|||||||
struct kevent *events;
|
struct kevent *events;
|
||||||
int nevents;
|
int nevents;
|
||||||
int kq;
|
int kq;
|
||||||
|
pid_t pid;
|
||||||
};
|
};
|
||||||
|
|
||||||
void *kq_init (struct event_base *);
|
void *kq_init (struct event_base *);
|
||||||
@ -114,6 +115,8 @@ kq_init(struct event_base *base)
|
|||||||
|
|
||||||
kqueueop->kq = kq;
|
kqueueop->kq = kq;
|
||||||
|
|
||||||
|
kqueueop->pid = getpid();
|
||||||
|
|
||||||
/* Initalize fields */
|
/* Initalize fields */
|
||||||
kqueueop->changes = malloc(NEVENT * sizeof(struct kevent));
|
kqueueop->changes = malloc(NEVENT * sizeof(struct kevent));
|
||||||
if (kqueueop->changes == NULL) {
|
if (kqueueop->changes == NULL) {
|
||||||
@ -411,7 +414,7 @@ kq_dealloc(struct event_base *base, void *arg)
|
|||||||
free(kqop->changes);
|
free(kqop->changes);
|
||||||
if (kqop->events)
|
if (kqop->events)
|
||||||
free(kqop->events);
|
free(kqop->events);
|
||||||
if (kqop->kq)
|
if (kqop->kq >= 0 && kqop->pid == getpid())
|
||||||
close(kqop->kq);
|
close(kqop->kq);
|
||||||
memset(kqop, 0, sizeof(struct kqop));
|
memset(kqop, 0, sizeof(struct kqop));
|
||||||
free(kqop);
|
free(kqop);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user