@@ -95,19 +95,20 @@ mono_w32file_read (gpointer handle, gpointer buffer, guint32 numbytes, guint32 *
95
95
96
96
gboolean interrupted ;
97
97
guint32 last_error ;
98
- gboolean res ;
98
+ gboolean res = FALSE ;
99
99
100
- MonoThreadInfo * info = mono_thread_info_current ();
100
+ mono_thread_info_install_interrupt (cancel_w32_io , handle , & interrupted );
101
+ if (interrupted )
102
+ return res ;
101
103
102
- mono_win32_enter_blocking_io_call (info , (HANDLE )handle );
103
104
MONO_ENTER_GC_SAFE ;
104
105
res = ReadFile ((HANDLE )handle , buffer , numbytes , (PDWORD )bytesread , NULL );
105
106
/* need to save and restore since clients expect error code set for
106
107
* failed IO calls and mono_thread_info_uninstall_interrupt overwrites value */
107
108
last_error = mono_w32error_get_last ();
108
109
109
110
MONO_EXIT_GC_SAFE ;
110
- mono_win32_leave_blocking_io_call ( info , ( HANDLE ) handle );
111
+ mono_thread_info_uninstall_interrupt ( & interrupted );
111
112
mono_w32error_set_last (last_error );
112
113
113
114
@@ -119,18 +120,19 @@ mono_w32file_write (gpointer handle, gconstpointer buffer, guint32 numbytes, gui
119
120
{
120
121
gboolean interrupted ;
121
122
guint32 last_error ;
122
- gboolean res ;
123
+ gboolean res = FALSE ;
123
124
124
- MonoThreadInfo * info = mono_thread_info_current ();
125
+ mono_thread_info_install_interrupt (cancel_w32_io , handle , & interrupted );
126
+ if (interrupted )
127
+ return res ;
125
128
126
- mono_win32_enter_blocking_io_call (info , (HANDLE )handle );
127
129
MONO_ENTER_GC_SAFE ;
128
130
res = WriteFile ((HANDLE )handle , buffer , numbytes , (PDWORD )byteswritten , NULL );
129
131
/* need to save and restore since clients expect error code set for
130
132
* failed IO calls and mono_thread_info_uninstall_interrupt overwrites value */
131
133
last_error = mono_w32error_get_last ();
132
134
MONO_EXIT_GC_SAFE ;
133
- mono_win32_leave_blocking_io_call ( info , ( HANDLE ) handle );
135
+ mono_thread_info_uninstall_interrupt ( & interrupted );
134
136
mono_w32error_set_last (last_error );
135
137
136
138
return res ;
0 commit comments