patch for async TCP sockets. without this change the callbacks will
[mono.git] / mono / metadata / threadpool.c
index ad2b3de06a0e155fe9558b6f2cd67bcba1f5f273..1eb527e00fc72013b136c9e4660051d0580fb778 100644 (file)
@@ -574,8 +574,8 @@ socket_io_add (MonoAsyncResult *ares, MonoSocketAsyncResult *state)
 
        mono_g_hash_table_replace (data->sock_to_state, state->handle, list);
        ievt = get_events_from_list (list);
-       LeaveCriticalSection (&data->io_lock);
        data->modify (data->event_data, fd, state->operation, ievt, is_new);
+        LeaveCriticalSection (&data->io_lock);
 }
 
 #ifndef DISABLE_SOCKETS