};
typedef struct _tp_epoll_data tp_epoll_data;
-static void tp_epoll_modify (gpointer event_data, int fd, int operation, int events, gboolean is_new);
+static void tp_epoll_modify (gpointer p, int fd, int operation, int events, gboolean is_new);
static void tp_epoll_shutdown (gpointer event_data);
static void tp_epoll_wait (gpointer event_data);
}
static void
-tp_epoll_modify (gpointer event_data, int fd, int operation, int events, gboolean is_new)
+tp_epoll_modify (gpointer p, int fd, int operation, int events, gboolean is_new)
{
- tp_epoll_data *data = event_data;
+ SocketIOData *socket_io_data;
+ tp_epoll_data *data;
struct epoll_event evt;
int epoll_op;
+ socket_io_data = p;
+ data = socket_io_data->event_data;
+
memset (&evt, 0, sizeof (evt));
evt.data.fd = fd;
if ((events & MONO_POLLIN) != 0)
}
}
}
+ mono_mutex_unlock (&socket_io_data->io_lock);
}
static void
{
SocketIOData *socket_io_data;
int epollfd;
- MonoInternalThread *thread;
struct epoll_event *events, *evt;
int ready = 0, i;
gpointer async_results [EPOLL_NEVENTS * 2]; // * 2 because each loop can add up to 2 results here
socket_io_data = p;
data = socket_io_data->event_data;
epollfd = data->epollfd;
- thread = mono_thread_internal_current ();
events = g_new0 (struct epoll_event, EPOLL_NEVENTS);
while (1) {
do {
if (ready == -1) {
- if (THREAD_WANTS_A_BREAK (thread))
- mono_thread_interruption_checkpoint ();
+ check_for_interruption_critical ();
}
ready = epoll_wait (epollfd, events, EPOLL_NEVENTS, -1);
} while (ready == -1 && errno == EINTR);
return;
}
- EnterCriticalSection (&socket_io_data->io_lock);
+ mono_mutex_lock (&socket_io_data->io_lock);
if (socket_io_data->inited == 3) {
g_free (events);
- LeaveCriticalSection (&socket_io_data->io_lock);
+ mono_mutex_unlock (&socket_io_data->io_lock);
return; /* cleanup called */
}
epoll_ctl (epollfd, EPOLL_CTL_DEL, fd, evt);
}
}
- LeaveCriticalSection (&socket_io_data->io_lock);
+ mono_mutex_unlock (&socket_io_data->io_lock);
threadpool_append_jobs (&async_io_tp, (MonoObject **) async_results, nresults);
- mono_gc_bzero (async_results, sizeof (gpointer) * nresults);
+ mono_gc_bzero_aligned (async_results, sizeof (gpointer) * nresults);
}
}
#undef EPOLL_NEVENTS