{
int ret;
struct _WapiHandle_socket *socket_handle = (struct _WapiHandle_socket *)data;
+ MonoThreadInfo *info = mono_thread_info_current ();
MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: closing socket handle %p", __func__, handle);
do {
ret = close (GPOINTER_TO_UINT(handle));
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending ());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
gint errnum = errno;
struct _WapiHandle_socket new_socket_handle = {0};
gboolean ok;
int new_fd;
+ MonoThreadInfo *info = mono_thread_info_current ();
if (addr != NULL && *addrlen < sizeof(struct sockaddr)) {
WSASetLastError (WSAEFAULT);
do {
new_fd = accept (fd, addr, addrlen);
} while (new_fd == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending());
+ !mono_thread_info_is_interrupt_state (info));
if (new_fd == -1) {
gint errnum = errno;
struct _WapiHandle_socket *socket_handle;
gboolean ok;
gint errnum;
-
+ MonoThreadInfo *info = mono_thread_info_current ();
+
if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
WSASetLastError (WSAENOTSOCK);
return(SOCKET_ERROR);
fds.fd = fd;
fds.events = MONO_POLLOUT;
while (mono_poll (&fds, 1, -1) == -1 &&
- !_wapi_thread_cur_apc_pending ()) {
+ !mono_thread_info_is_interrupt_state (info)) {
if (errno != EINTR) {
errnum = errno_to_WSA (errno, __func__);
struct _WapiHandle_socket *socket_handle;
gboolean ok;
int ret;
+ MonoThreadInfo *info = mono_thread_info_current ();
if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
WSASetLastError (WSAENOTSOCK);
do {
ret = recvfrom (fd, buf, len, recv_flags, from, fromlen);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending ());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == 0 && len > 0) {
/* According to the Linux man page, recvfrom only
struct _WapiHandle_socket *socket_handle;
gboolean ok;
int ret;
+ MonoThreadInfo *info = mono_thread_info_current ();
if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
WSASetLastError (WSAENOTSOCK);
do {
ret = recvmsg (fd, msg, recv_flags);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending ());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == 0) {
/* see _wapi_recvfrom */
{
gpointer handle = GUINT_TO_POINTER (fd);
int ret;
+ MonoThreadInfo *info = mono_thread_info_current ();
if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
WSASetLastError (WSAENOTSOCK);
do {
ret = send (fd, msg, len, send_flags);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending ());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
gint errnum = errno;
{
gpointer handle = GUINT_TO_POINTER (fd);
int ret;
+ MonoThreadInfo *info = mono_thread_info_current ();
if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
WSASetLastError (WSAENOTSOCK);
do {
ret = sendto (fd, msg, len, send_flags, to, tolen);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending ());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
gint errnum = errno;
{
gpointer handle = GUINT_TO_POINTER (fd);
int ret;
+ MonoThreadInfo *info = mono_thread_info_current ();
if (mono_w32handle_get_type (handle) != MONO_W32HANDLE_SOCKET) {
WSASetLastError (WSAENOTSOCK);
do {
ret = sendmsg (fd, msg, send_flags);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending ());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
gint errnum = errno;
static gint
wapi_sendfile (guint32 socket, gpointer fd, guint32 bytes_to_write, guint32 bytes_per_send, guint32 flags)
{
+ MonoThreadInfo *info = mono_thread_info_current ();
#if defined(HAVE_SENDFILE) && (defined(__linux__) || defined(DARWIN))
gint file = GPOINTER_TO_INT (fd);
gint n;
/* TODO: Might not send the entire file for non-blocking sockets */
res = sendfile (file, socket, 0, &statbuf.st_size, NULL, 0);
#endif
- } while (res != -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
+ } while (res != -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
if (res == -1) {
errnum = errno;
errnum = errno_to_WSA (errnum, __func__);
do {
do {
n = read (file, buffer, SF_BUFFER_SIZE);
- } while (n == -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
+ } while (n == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
if (n == -1)
break;
if (n == 0) {
}
do {
n = send (socket, buffer, n, 0); /* short sends? enclose this in a loop? */
- } while (n == -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
- } while (n != -1 && errno == EINTR && !_wapi_thread_cur_apc_pending ());
+ } while (n == -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
+ } while (n != -1 && errno == EINTR && !mono_thread_info_is_interrupt_state (info));
if (n == -1) {
gint errnum = errno;
fd_set *exceptfds, struct timeval *timeout)
{
int ret, maxfd;
+ MonoThreadInfo *info = mono_thread_info_current ();
for (maxfd = FD_SETSIZE-1; maxfd >= 0; maxfd--) {
if ((readfds && FD_ISSET (maxfd, readfds)) ||
ret = select(maxfd + 1, readfds, writefds, exceptfds,
timeout);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending ());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
gint errnum = errno;