struct _WapiHandle_file *file_handle;
gboolean ok;
int fd, ret;
+ MonoThreadInfo *info = mono_thread_info_current ();
ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
(gpointer *)&file_handle);
do {
ret = read (fd, buffer, numbytes);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending());
+ !mono_thread_info_is_interrupt_state (info));
if(ret==-1) {
gint err = errno;
gboolean ok;
int ret, fd;
off_t current_pos = 0;
+ MonoThreadInfo *info = mono_thread_info_current ();
ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
(gpointer *)&file_handle);
do {
ret = write (fd, buffer, numbytes);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending());
+ !mono_thread_info_is_interrupt_state (info));
if (lock_while_writing) {
_wapi_unlock_file_region (fd, current_pos, numbytes);
struct stat statbuf;
off_t pos;
int ret, fd;
+ MonoThreadInfo *info = mono_thread_info_current ();
ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_FILE,
(gpointer *)&file_handle);
do {
ret = write (fd, "", 1);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending());
+ !mono_thread_info_is_interrupt_state (info));
if(ret==-1) {
MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p extend write failed: %s", __func__, handle, strerror(errno));
do {
ret=ftruncate(fd, pos);
}
- while (ret==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending());
+ while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info));
if(ret==-1) {
MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p ftruncate failed: %s", __func__,
handle, strerror(errno));
struct _WapiHandle_file *console_handle;
gboolean ok;
int ret, fd;
+ MonoThreadInfo *info = mono_thread_info_current ();
ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
(gpointer *)&console_handle);
do {
ret=read(fd, buffer, numbytes);
- } while (ret==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending());
+ } while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info));
if(ret==-1) {
MONO_TRACE (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: read of handle %p error: %s", __func__, handle,
struct _WapiHandle_file *console_handle;
gboolean ok;
int ret, fd;
+ MonoThreadInfo *info = mono_thread_info_current ();
ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_CONSOLE,
(gpointer *)&console_handle);
do {
ret = write(fd, buffer, numbytes);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
if (errno == EINTR) {
struct _WapiHandle_file *pipe_handle;
gboolean ok;
int ret, fd;
+ MonoThreadInfo *info = mono_thread_info_current ();
ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_PIPE,
(gpointer *)&pipe_handle);
do {
ret=read(fd, buffer, numbytes);
- } while (ret==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending());
+ } while (ret==-1 && errno==EINTR && !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
if (errno == EINTR) {
struct _WapiHandle_file *pipe_handle;
gboolean ok;
int ret, fd;
+ MonoThreadInfo *info = mono_thread_info_current ();
ok=mono_w32handle_lookup (handle, MONO_W32HANDLE_PIPE,
(gpointer *)&pipe_handle);
do {
ret = write (fd, buffer, numbytes);
} while (ret == -1 && errno == EINTR &&
- !_wapi_thread_cur_apc_pending());
+ !mono_thread_info_is_interrupt_state (info));
if (ret == -1) {
if (errno == EINTR) {
int remain, n;
char *buf, *wbuf;
int buf_size = st_src->st_blksize;
+ MonoThreadInfo *info = mono_thread_info_current ();
buf_size = buf_size < 8192 ? 8192 : (buf_size > 65536 ? 65536 : buf_size);
buf = (char *) malloc (buf_size);
for (;;) {
remain = read (src_fd, buf, buf_size);
if (remain < 0) {
- if (errno == EINTR && !_wapi_thread_cur_apc_pending ())
+ if (errno == EINTR && !mono_thread_info_is_interrupt_state (info))
continue;
if (report_errors)
wbuf = buf;
while (remain > 0) {
if ((n = write (dest_fd, wbuf, remain)) < 0) {
- if (errno == EINTR && !_wapi_thread_cur_apc_pending ())
+ if (errno == EINTR && !mono_thread_info_is_interrupt_state (info))
continue;
if (report_errors)
{
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;