mirror of
https://github.com/cuberite/libevent.git
synced 2025-09-09 12:28:19 -04:00
OSX compilation issues
svn:r1453
This commit is contained in:
parent
c9c4ec26ee
commit
b89b58b5f4
12
kqueue.c
12
kqueue.c
@ -61,6 +61,8 @@
|
|||||||
#include "event-internal.h"
|
#include "event-internal.h"
|
||||||
#include "log-internal.h"
|
#include "log-internal.h"
|
||||||
#include "evmap-internal.h"
|
#include "evmap-internal.h"
|
||||||
|
#include "event2/thread.h"
|
||||||
|
#include "evthread-internal.h"
|
||||||
|
|
||||||
#define NEVENT 64
|
#define NEVENT 64
|
||||||
|
|
||||||
@ -139,7 +141,7 @@ kq_init(struct event_base *base)
|
|||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
kqueueop->pend_changes = mm_malloc(NEVENT * sizeof(struct kevent));
|
kqueueop->pend_changes = mm_malloc(NEVENT * sizeof(struct kevent));
|
||||||
if (kqueueop->pendchanges == NULL) {
|
if (kqueueop->pend_changes == NULL) {
|
||||||
mm_free (kqueueop->changes);
|
mm_free (kqueueop->changes);
|
||||||
mm_free (kqueueop);
|
mm_free (kqueueop);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
@ -243,17 +245,17 @@ kq_dispatch(struct event_base *base, struct timeval *tv)
|
|||||||
* we're looking at in pend_changes, and let other threads mess with
|
* we're looking at in pend_changes, and let other threads mess with
|
||||||
* changes. */
|
* changes. */
|
||||||
SWAP(struct kevent *, kqop->changes, kqop->pend_changes);
|
SWAP(struct kevent *, kqop->changes, kqop->pend_changes);
|
||||||
SWAP(int, kqop->nchanges, kqop->npend_changes);
|
SWAP(int, kqop->nchanges, kqop->n_pend_changes);
|
||||||
SWAP(int, kqop->changes_size, kqop->pend_changes_size);
|
SWAP(int, kqop->changes_size, kqop->pend_changes_size);
|
||||||
|
|
||||||
EVBASE_RELEASE_LOCK(base, EVTHREAD_WRITE, th_base_lock);
|
EVBASE_RELEASE_LOCK(base, EVTHREAD_WRITE, th_base_lock);
|
||||||
|
|
||||||
res = kevent(kqop->kq, kqop->pend_changes, kqop->npend_changes,
|
res = kevent(kqop->kq, kqop->pend_changes, kqop->n_pend_changes,
|
||||||
events, kqop->events_size, ts_p);
|
events, kqop->events_size, ts_p);
|
||||||
|
|
||||||
EVBASE_ACQUIRE_LOCK(base, EVTHREAD_WRITE, th_base_lock);
|
EVBASE_ACQUIRE_LOCK(base, EVTHREAD_WRITE, th_base_lock);
|
||||||
|
|
||||||
kqop->npend_changes = 0;
|
kqop->n_pend_changes = 0;
|
||||||
if (res == -1) {
|
if (res == -1) {
|
||||||
if (errno != EINTR) {
|
if (errno != EINTR) {
|
||||||
event_warn("kevent");
|
event_warn("kevent");
|
||||||
@ -307,7 +309,7 @@ kq_dispatch(struct event_base *base, struct timeval *tv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (res == kqop->nevents) {
|
if (res == kqop->events_size) {
|
||||||
struct kevent *newresult;
|
struct kevent *newresult;
|
||||||
int size = kqop->events_size;
|
int size = kqop->events_size;
|
||||||
/* We used all the events space that we have. Maybe we should
|
/* We used all the events space that we have. Maybe we should
|
||||||
|
Loading…
x
Reference in New Issue
Block a user