Merge pull request #3951 from akoeplinger/add-csproj-warning
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Mon, 14 Nov 2016 19:26:47 +0000 (20:26 +0100)
committerGitHub <noreply@github.com>
Mon, 14 Nov 2016 19:26:47 +0000 (20:26 +0100)
[msvc] Add warning about autogenerated csproj to genproj

15 files changed:
mcs/class/System/Mono.Btls/MonoBtlsContext.cs
mcs/class/System/Mono.Net.Security/MobileTlsContext.cs
mono/io-layer/sockets.c
mono/metadata/loader.h
mono/metadata/metadata-internals.h
mono/metadata/w32event-unix.c
mono/metadata/w32handle-namespace.c
mono/metadata/w32handle.c
mono/metadata/w32handle.h
mono/metadata/w32mutex-unix.c
mono/metadata/w32semaphore-unix.c
mono/utils/os-event-unix.c
mono/utils/os-event.h
msvc/mono.def
msvc/monosgen.def

index e4054a173c8d3e5c221b5bbb2f6a4995a52f2237..051656ce0536f5bff3e4a82fc9f2ed76d344f823 100644 (file)
@@ -135,7 +135,7 @@ namespace Mono.Btls
                        if (IsServer) {
                                SetPrivateCertificate (nativeServerCertificate);
                        } else {
-                               ssl.SetServerName (TargetHost);
+                               ssl.SetServerName (ServerName);
                        }
                }
 
@@ -233,14 +233,7 @@ namespace Mono.Btls
                        if (!IsServer)
                                ctx.SetSelectCallback (SelectCallback);
 
-                       var host = TargetHost;
-                       if (!string.IsNullOrEmpty (host)) {
-                               var pos = TargetHost.IndexOf (':');
-                               if (pos > 0)
-                                       host = host.Substring (0, pos);
-                       }
-
-                       ctx.SetVerifyParam (MonoBtlsProvider.GetVerifyParam (host, IsServer));
+                       ctx.SetVerifyParam (MonoBtlsProvider.GetVerifyParam (ServerName, IsServer));
 
                        TlsProtocolCode minProtocol, maxProtocol;
                        GetProtocolVersions (out minProtocol, out maxProtocol);
index f051a5fcbc2c04ca406f2edebcf63019cc0af693..79f0468d4619aee415b238d9171366fe801abb8e 100644 (file)
@@ -35,6 +35,7 @@ namespace Mono.Net.Security
                MobileAuthenticatedStream parent;
                bool serverMode;
                string targetHost;
+               string serverName;
                SslProtocols enabledProtocols;
                X509Certificate serverCertificate;
                X509CertificateCollection clientCertificates;
@@ -54,6 +55,13 @@ namespace Mono.Net.Security
                        this.clientCertificates = clientCertificates;
                        this.askForClientCert = askForClientCert;
 
+                       serverName = targetHost;
+                       if (!string.IsNullOrEmpty (serverName)) {
+                               var pos = serverName.IndexOf (':');
+                               if (pos > 0)
+                                       serverName = serverName.Substring (0, pos);
+                       }
+
                        certificateValidator = CertificateValidationHelper.GetInternalValidator (
                                parent.Settings, parent.Provider);
                }
@@ -92,6 +100,10 @@ namespace Mono.Net.Security
                        get { return targetHost; }
                }
 
+               protected string ServerName {
+                       get { return serverName; }
+               }
+
                protected bool AskForClientCertificate {
                        get { return askForClientCert; }
                }
index b374973ebc67288c7b5fe9ba35c64c50d1a40856..d98ac677a2e22047432a89a717ad9b1a849f37ed 100644 (file)
@@ -130,7 +130,7 @@ static gboolean
 cleanup_close (gpointer handle, gpointer data, gpointer user_data)
 {
        if (mono_w32handle_get_type (handle) == MONO_W32HANDLE_SOCKET)
-               mono_w32handle_ops_close (handle, data);
+               mono_w32handle_force_close (handle, data);
 
        return FALSE;
 }
index 6382c774ae3fd431d61f741df0456253a4847d44..328cb5ac7583312904112bbfb933f779f8a9c402 100644 (file)
@@ -4,7 +4,6 @@
 #include <mono/metadata/metadata.h>
 #include <mono/metadata/image.h>
 #include <mono/utils/mono-error.h>
-#include <mono/utils/mono-dl.h>
 
 MONO_BEGIN_DECLS
 
@@ -64,9 +63,6 @@ mono_lookup_internal_call (MonoMethod *method);
 void*
 mono_lookup_internal_call_full (MonoMethod *method, mono_bool *uses_handles);
 
-void
-mono_loader_register_module (const char *name, MonoDl *module);
-
 MONO_API const char*
 mono_lookup_icall_symbol (MonoMethod *m);
 
index a68897538aec5f910d666a786c38532051f87d5d..1c82b442e2798dbc7ce8fdcf4855fc7c9bdc8ed3 100644 (file)
@@ -917,5 +917,8 @@ mono_image_set_description (MonoImageSet *);
 MonoImageSet *
 mono_find_image_set_owner (void *ptr);
 
+void
+mono_loader_register_module (const char *name, MonoDl *module);
+
 #endif /* __MONO_METADATA_INTERNALS_H__ */
 
index 6fc2a223214e81f4e2799e225f8b6e320e8b28bc..6c95aaf56c9e97a4f48828e29a602be528d04970 100644 (file)
@@ -34,12 +34,12 @@ static gboolean event_handle_own (gpointer handle, MonoW32HandleType type, guint
        ok = mono_w32handle_lookup (handle, type, (gpointer *)&event_handle);
        if (!ok) {
                g_warning ("%s: error looking up %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
                return FALSE;
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        if (!event_handle->manual) {
                g_assert (event_handle->set_count > 0);
@@ -178,7 +178,7 @@ static gpointer event_handle_create (MonoW32HandleEvent *event_handle, MonoW32Ha
        handle = mono_w32handle_new (type, event_handle);
        if (handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating %s handle",
-                       __func__, mono_w32handle_ops_typename (type));
+                       __func__, mono_w32handle_get_typename (type));
                SetLastError (ERROR_GEN_FAILURE);
                return NULL;
        }
@@ -191,7 +191,7 @@ static gpointer event_handle_create (MonoW32HandleEvent *event_handle, MonoW32Ha
        mono_w32handle_unlock_handle (handle);
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        return handle;
 }
@@ -200,7 +200,7 @@ static gpointer event_create (gboolean manual, gboolean initial)
 {
        MonoW32HandleEvent event_handle;
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
-               __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_EVENT));
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_EVENT));
        return event_handle_create (&event_handle, MONO_W32HANDLE_EVENT, manual, initial);
 }
 
@@ -210,7 +210,7 @@ static gpointer namedevent_create (gboolean manual, gboolean initial, const guni
        gchar *utf8_name;
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
-               __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDEVENT));
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDEVENT));
 
        /* w32 seems to guarantee that opening named objects can't race each other */
        mono_w32handle_namespace_lock ();
@@ -283,12 +283,12 @@ ves_icall_System_Threading_Events_SetEvent_internal (gpointer handle)
 
        if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
                g_warning ("%s: error looking up %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
                return FALSE;
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: setting %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        mono_w32handle_lock_handle (handle);
 
@@ -328,21 +328,21 @@ ves_icall_System_Threading_Events_ResetEvent_internal (gpointer handle)
 
        if (!mono_w32handle_lookup (handle, type, (gpointer *)&event_handle)) {
                g_warning ("%s: error looking up %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
                return FALSE;
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: resetting %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        mono_w32handle_lock_handle (handle);
 
        if (!mono_w32handle_issignalled (handle)) {
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: no need to reset %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
        } else {
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: obtained write lock on %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
 
                mono_w32handle_set_signal_state (handle, FALSE, FALSE);
        }
index 1ca4e1dd8c57162da5177bc0eaacafe6fad0166c..2eb2145533b6d804c6e285cc7848803e38e1e8cf 100644 (file)
@@ -84,7 +84,7 @@ mono_w32handle_namespace_search_handle_callback (gpointer handle, gpointer data,
                if (type != search_data->type) {
                        /* Its the wrong type, so fail now */
                        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name but is wrong type: %s",
-                               __func__, handle, mono_w32handle_ops_typename (type));
+                               __func__, handle, mono_w32handle_get_typename (type));
                        search_data->ret = INVALID_HANDLE_VALUE;
                } else {
                        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: handle %p matches name and type",
@@ -111,7 +111,7 @@ mono_w32handle_namespace_search_handle (MonoW32HandleType type, gchar *name)
                g_error ("%s: type %s does not have a namespace", __func__, type);
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: Lookup for handle named [%s] type %s",
-               __func__, name, mono_w32handle_ops_typename (type));
+               __func__, name, mono_w32handle_get_typename (type));
 
        search_data.ret = NULL;
        search_data.type = type;
index 59209c4601ba48ab67abf7b22426303e5a35a2d2..ef3b24838e1729459f9da4c99ddc7a834ce51aa7 100644 (file)
  */
 
 #include <config.h>
-
-#if !defined(HOST_WIN32)
-
 #include <glib.h>
-#include <pthread.h>
-#include <errno.h>
-#include <unistd.h>
-#ifdef HAVE_SIGNAL_H
-#include <signal.h>
-#endif
-#include <string.h>
-#include <sys/types.h>
-#ifdef HAVE_SYS_SOCKET_H
-#  include <sys/socket.h>
-#endif
-#ifdef HAVE_SYS_UN_H
-#  include <sys/un.h>
-#endif
-#ifdef HAVE_SYS_MMAN_H
-#  include <sys/mman.h>
-#endif
-#ifdef HAVE_DIRENT_H
-#  include <dirent.h>
-#endif
-#include <sys/stat.h>
-#ifdef HAVE_SYS_RESOURCE_H
-#  include <sys/resource.h>
-#endif
 
 #include "w32handle.h"
 
@@ -141,6 +114,15 @@ mono_w32handle_get_type (gpointer handle)
        return handle_data->type;
 }
 
+static const gchar*
+mono_w32handle_ops_typename (MonoW32HandleType type);
+
+const gchar*
+mono_w32handle_get_typename (MonoW32HandleType type)
+{
+       return mono_w32handle_ops_typename (type);
+}
+
 void
 mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast)
 {
@@ -336,6 +318,9 @@ mono_w32handle_cleanup (void)
                g_free (private_handles [i]);
 }
 
+static gsize
+mono_w32handle_ops_typesize (MonoW32HandleType type);
+
 static void mono_w32handle_init_handle (MonoW32HandleBase *handle,
                               MonoW32HandleType type, gpointer handle_specific)
 {
@@ -678,6 +663,15 @@ mono_w32handle_unref (gpointer handle)
        }
 }
 
+static void
+mono_w32handle_ops_close (gpointer handle, gpointer data);
+
+void
+mono_w32handle_force_close (gpointer handle, gpointer data)
+{
+       mono_w32handle_ops_close (handle, data);
+}
+
 void
 mono_w32handle_register_ops (MonoW32HandleType type, MonoW32HandleOps *ops)
 {
@@ -718,7 +712,8 @@ static void (*_wapi_handle_ops_get_close_func (MonoW32HandleType type))(gpointer
        return (NULL);
 }
 
-void mono_w32handle_ops_close (gpointer handle, gpointer data)
+static void
+mono_w32handle_ops_close (gpointer handle, gpointer data)
 {
        MonoW32HandleBase *handle_data;
        MonoW32HandleType type;
@@ -735,7 +730,8 @@ void mono_w32handle_ops_close (gpointer handle, gpointer data)
        }
 }
 
-void mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
+static void
+mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
 {
        if (handle_ops[type] != NULL &&
            handle_ops[type]->details != NULL) {
@@ -743,21 +739,24 @@ void mono_w32handle_ops_details (MonoW32HandleType type, gpointer data)
        }
 }
 
-const gchar* mono_w32handle_ops_typename (MonoW32HandleType type)
+static const gchar*
+mono_w32handle_ops_typename (MonoW32HandleType type)
 {
        g_assert (handle_ops [type]);
        g_assert (handle_ops [type]->typename);
        return handle_ops [type]->typename ();
 }
 
-gsize mono_w32handle_ops_typesize (MonoW32HandleType type)
+static gsize
+mono_w32handle_ops_typesize (MonoW32HandleType type)
 {
        g_assert (handle_ops [type]);
        g_assert (handle_ops [type]->typesize);
        return handle_ops [type]->typesize ();
 }
 
-void mono_w32handle_ops_signal (gpointer handle)
+static void
+mono_w32handle_ops_signal (gpointer handle)
 {
        MonoW32HandleBase *handle_data;
        MonoW32HandleType type;
@@ -773,7 +772,8 @@ void mono_w32handle_ops_signal (gpointer handle)
        }
 }
 
-gboolean mono_w32handle_ops_own (gpointer handle, guint32 *statuscode)
+static gboolean
+mono_w32handle_ops_own (gpointer handle, guint32 *statuscode)
 {
        MonoW32HandleBase *handle_data;
        MonoW32HandleType type;
@@ -791,7 +791,8 @@ gboolean mono_w32handle_ops_own (gpointer handle, guint32 *statuscode)
        }
 }
 
-gboolean mono_w32handle_ops_isowned (gpointer handle)
+static gboolean
+mono_w32handle_ops_isowned (gpointer handle)
 {
        MonoW32HandleBase *handle_data;
        MonoW32HandleType type;
@@ -809,7 +810,7 @@ gboolean mono_w32handle_ops_isowned (gpointer handle)
        }
 }
 
-MonoW32HandleWaitRet
+static MonoW32HandleWaitRet
 mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted)
 {
        MonoW32HandleBase *handle_data;
@@ -829,7 +830,8 @@ mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *aler
        }
 }
 
-void mono_w32handle_ops_prewait (gpointer handle)
+static void
+mono_w32handle_ops_prewait (gpointer handle)
 {
        MonoW32HandleBase *handle_data;
        MonoW32HandleType type;
@@ -849,6 +851,9 @@ void mono_w32handle_ops_prewait (gpointer handle)
 static void
 spin (guint32 ms)
 {
+#ifdef HOST_WIN32
+       SleepEx (ms, TRUE);
+#else
        struct timespec sleepytime;
 
        g_assert (ms < 1000);
@@ -856,6 +861,7 @@ spin (guint32 ms)
        sleepytime.tv_sec = 0;
        sleepytime.tv_nsec = ms * 1000000;
        nanosleep (&sleepytime, NULL);
+#endif /* HOST_WIN32 */
 }
 
 static void
@@ -1444,5 +1450,3 @@ done:
 
        return ret;
 }
-
-#endif /* !defined(HOST_WIN32) */
index 54386fabeb15e2ccc70872eba4f4cef1d5918ffe..ce7d76ec68824cebc75436a4399d38e2116dbd82 100644 (file)
@@ -108,6 +108,9 @@ mono_w32handle_new_fd (MonoW32HandleType type, int fd, gpointer handle_specific)
 MonoW32HandleType
 mono_w32handle_get_type (gpointer handle);
 
+const gchar*
+mono_w32handle_get_typename (MonoW32HandleType type);
+
 gboolean
 mono_w32handle_lookup (gpointer handle, MonoW32HandleType type, gpointer *handle_specific);
 
@@ -130,31 +133,7 @@ gboolean
 mono_w32handle_test_capabilities (gpointer handle, MonoW32HandleCapability caps);
 
 void
-mono_w32handle_ops_close (gpointer handle, gpointer data);
-
-void
-mono_w32handle_ops_signal (gpointer handle);
-
-gboolean
-mono_w32handle_ops_own (gpointer handle, guint32 *statuscode);
-
-gboolean
-mono_w32handle_ops_isowned (gpointer handle);
-
-MonoW32HandleWaitRet
-mono_w32handle_ops_specialwait (gpointer handle, guint32 timeout, gboolean *alerted);
-
-void
-mono_w32handle_ops_prewait (gpointer handle);
-
-void
-mono_w32handle_ops_details (MonoW32HandleType type, gpointer data);
-
-const gchar*
-mono_w32handle_ops_typename (MonoW32HandleType type);
-
-gsize
-mono_w32handle_ops_typesize (MonoW32HandleType type);
+mono_w32handle_force_close (gpointer handle, gpointer data);
 
 void
 mono_w32handle_set_signal_state (gpointer handle, gboolean state, gboolean broadcast);
index 35ddea5ee1487230eb02a19493172c15880b8b49..d27fd5b8a586dbb182643b647e97dcafadd97d95 100644 (file)
@@ -66,12 +66,12 @@ mutex_handle_own (gpointer handle, MonoW32HandleType type, guint32 *statuscode)
        *statuscode = WAIT_OBJECT_0;
 
        if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
-               g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
+               g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_get_typename (type), handle);
                return FALSE;
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p, before: [tid: %p, recursion: %d], after: [tid: %p, recursion: %d], abandoned: %s",
-               __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false");
+               __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion, (gpointer) pthread_self (), mutex_handle->recursion + 1, mutex_handle->abandoned ? "true" : "false");
 
        if (mutex_handle->recursion != 0) {
                g_assert (pthread_equal (pthread_self (), mutex_handle->tid));
@@ -99,20 +99,20 @@ mutex_handle_is_owned (gpointer handle, MonoW32HandleType type)
        MonoW32HandleMutex *mutex_handle;
 
        if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
-               g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_ops_typename (type), handle);
+               g_warning ("%s: error looking up %s handle %p", __func__, mono_w32handle_get_typename (type), handle);
                return FALSE;
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: testing ownership %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        if (mutex_handle->recursion > 0 && pthread_equal (mutex_handle->tid, pthread_self ())) {
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p owned by %p",
-                       __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self ());
+                       __func__, mono_w32handle_get_typename (type), handle, (gpointer) pthread_self ());
                return TRUE;
        } else {
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p not owned by %p, tid: %p recursion: %d",
-                       __func__, mono_w32handle_ops_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion);
+                       __func__, mono_w32handle_get_typename (type), handle, (gpointer) pthread_self (), (gpointer) mutex_handle->tid, mutex_handle->recursion);
                return FALSE;
        }
 }
@@ -161,12 +161,12 @@ static void mutex_handle_prewait (gpointer handle, MonoW32HandleType type)
 
        if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
                g_warning ("%s: error looking up %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
                return;
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: pre-waiting %s handle %p, owned? %s",
-               __func__, mono_w32handle_ops_typename (type), handle, mutex_handle->recursion != 0 ? "true" : "false");
+               __func__, mono_w32handle_get_typename (type), handle, mutex_handle->recursion != 0 ? "true" : "false");
 }
 
 /* The shared state is not locked when prewait methods are called */
@@ -273,7 +273,7 @@ static gpointer mutex_handle_create (MonoW32HandleMutex *mutex_handle, MonoW32Ha
        handle = mono_w32handle_new (type, mutex_handle);
        if (handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating %s handle",
-                       __func__, mono_w32handle_ops_typename (type));
+                       __func__, mono_w32handle_get_typename (type));
                SetLastError (ERROR_GEN_FAILURE);
                return NULL;
        }
@@ -288,7 +288,7 @@ static gpointer mutex_handle_create (MonoW32HandleMutex *mutex_handle, MonoW32Ha
        mono_w32handle_unlock_handle (handle);
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        return handle;
 }
@@ -297,7 +297,7 @@ static gpointer mutex_create (gboolean owned)
 {
        MonoW32HandleMutex mutex_handle;
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
-               __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_MUTEX));
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_MUTEX));
        return mutex_handle_create (&mutex_handle, MONO_W32HANDLE_MUTEX, owned);
 }
 
@@ -307,7 +307,7 @@ static gpointer namedmutex_create (gboolean owned, const gunichar2 *name)
        gchar *utf8_name;
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle",
-               __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDMUTEX));
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDMUTEX));
 
        /* w32 seems to guarantee that opening named objects can't race each other */
        mono_w32handle_namespace_lock ();
@@ -389,12 +389,12 @@ ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle)
 
        if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
                g_warning ("%s: error looking up %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
                return FALSE;
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p, tid: %p recursion: %d",
-               __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+               __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
 
        mono_w32handle_lock_handle (handle);
 
@@ -407,7 +407,7 @@ ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle)
                ret = FALSE;
 
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: we don't own %s handle %p (owned by %ld, me %ld)",
-                           __func__, mono_w32handle_ops_typename (type), handle, (long)mutex_handle->tid, (long)tid);
+                           __func__, mono_w32handle_get_typename (type), handle, (long)mutex_handle->tid, (long)tid);
        } else {
                ret = TRUE;
 
@@ -418,7 +418,7 @@ ves_icall_System_Threading_Mutex_ReleaseMutex_internal (gpointer handle)
                        thread_disown_mutex (mono_thread_internal_current (), handle);
 
                        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: unlocking %s handle %p, tid: %p recusion : %d",
-                               __func__, mono_w32handle_ops_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
+                               __func__, mono_w32handle_get_typename (type), handle, (gpointer) mutex_handle->tid, mutex_handle->recursion);
 
                        mutex_handle->tid = 0;
                        mono_w32handle_set_signal_state (handle, TRUE, FALSE);
@@ -499,11 +499,11 @@ mono_w32mutex_abandon (void)
 
                if (!mono_w32handle_lookup (handle, type, (gpointer *)&mutex_handle)) {
                        g_error ("%s: error looking up %s handle %p",
-                               __func__, mono_w32handle_ops_typename (type), handle);
+                               __func__, mono_w32handle_get_typename (type), handle);
                }
 
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoning %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
 
                tid = MONO_UINT_TO_NATIVE_THREAD_ID (internal->tid);
 
@@ -522,7 +522,7 @@ mono_w32mutex_abandon (void)
                thread_disown_mutex (internal, handle);
 
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: abandoned %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
 
                mono_w32handle_unlock_handle (handle);
        }
index 7fddcf988d364845cdf520116e6636c5b9c67bcb..f0a93d1f985384045bcff34f5d44debd2d2d3270 100644 (file)
@@ -32,12 +32,12 @@ static gboolean sem_handle_own (gpointer handle, MonoW32HandleType type, guint32
 
        if (!mono_w32handle_lookup (handle, type, (gpointer *)&sem_handle)) {
                g_warning ("%s: error looking up %s handle %p",
-                       __func__, mono_w32handle_ops_typename (type), handle);
+                       __func__, mono_w32handle_get_typename (type), handle);
                return FALSE;
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: owning %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        sem_handle->val--;
 
@@ -147,7 +147,7 @@ sem_handle_create (MonoW32HandleSemaphore *sem_handle, MonoW32HandleType type, g
        handle = mono_w32handle_new (type, sem_handle);
        if (handle == INVALID_HANDLE_VALUE) {
                g_warning ("%s: error creating %s handle",
-                       __func__, mono_w32handle_ops_typename (type));
+                       __func__, mono_w32handle_get_typename (type));
                SetLastError (ERROR_GEN_FAILURE);
                return NULL;
        }
@@ -160,7 +160,7 @@ sem_handle_create (MonoW32HandleSemaphore *sem_handle, MonoW32HandleType type, g
        mono_w32handle_unlock_handle (handle);
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: created %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        return handle;
 }
@@ -170,7 +170,7 @@ sem_create (gint32 initial, gint32 max)
 {
        MonoW32HandleSemaphore sem_handle;
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d",
-               __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_SEM), initial, max);
+               __func__, mono_w32handle_get_typename (MONO_W32HANDLE_SEM), initial, max);
        return sem_handle_create (&sem_handle, MONO_W32HANDLE_SEM, initial, max);
 }
 
@@ -181,7 +181,7 @@ namedsem_create (gint32 initial, gint32 max, const gunichar2 *name)
        gchar *utf8_name;
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: creating %s handle, initial %d max %d name \"%s\"",
-                   __func__, mono_w32handle_ops_typename (MONO_W32HANDLE_NAMEDSEM), initial, max, (const char*)name);
+                   __func__, mono_w32handle_get_typename (MONO_W32HANDLE_NAMEDSEM), initial, max, (const char*)name);
 
        /* w32 seems to guarantee that opening named objects can't race each other */
        mono_w32handle_namespace_lock ();
@@ -279,7 +279,7 @@ ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle,
        }
 
        mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: releasing %s handle %p",
-               __func__, mono_w32handle_ops_typename (type), handle);
+               __func__, mono_w32handle_get_typename (type), handle);
 
        mono_w32handle_lock_handle (handle);
 
@@ -291,12 +291,12 @@ ves_icall_System_Threading_Semaphore_ReleaseSemaphore_internal (gpointer handle,
        /* No idea why max is signed, but thats the spec :-( */
        if (sem_handle->val + releaseCount > (guint32)sem_handle->max) {
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d, max value would be exceeded",
-                       __func__, mono_w32handle_ops_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
+                       __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
 
                ret = FALSE;
        } else {
                mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s: %s handle %p val %d count %d max %d",
-                       __func__, mono_w32handle_ops_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
+                       __func__, mono_w32handle_get_typename (type), handle, sem_handle->val, releaseCount, sem_handle->max);
 
                sem_handle->val += releaseCount;
                mono_w32handle_set_signal_state (handle, TRUE, TRUE);
index 06e9639d0c2f010959f5d306f7aa46c3f24c78c4..611cb76ffbc69038a739470bcad367cd6df8102a 100644 (file)
 static mono_lazy_init_t status = MONO_LAZY_INIT_STATUS_NOT_INITIALIZED;
 
 static mono_mutex_t signal_mutex;
-static mono_cond_t signal_cond;
 
 static void
 initialize (void)
 {
        mono_os_mutex_init (&signal_mutex);
-       mono_os_cond_init (&signal_cond);
 }
 
 void
@@ -33,8 +31,7 @@ mono_os_event_init (MonoOSEvent *event, gboolean initial)
 
        mono_lazy_initialize (&status, initialize);
 
-       mono_os_mutex_init (&event->mutex);
-       mono_os_cond_init (&event->cond);
+       event->conds = g_ptr_array_new ();
        event->signalled = initial;
 }
 
@@ -45,8 +42,10 @@ mono_os_event_destroy (MonoOSEvent *event)
 
        g_assert (event);
 
-       mono_os_mutex_destroy (&event->mutex);
-       mono_os_cond_destroy (&event->cond);
+       if (event->conds->len > 0)
+               g_error ("%s: cannot destroy osevent, there are still %d threads waiting on it", __func__, event->conds->len);
+
+       g_ptr_array_free (event->conds, TRUE);
 }
 
 static gboolean
@@ -58,19 +57,19 @@ mono_os_event_is_signalled (MonoOSEvent *event)
 void
 mono_os_event_set (MonoOSEvent *event)
 {
+       gsize i;
+
        g_assert (mono_lazy_is_initialized (&status));
 
        g_assert (event);
 
-       mono_os_mutex_lock (&event->mutex);
        mono_os_mutex_lock (&signal_mutex);
 
        event->signalled = TRUE;
 
-       mono_os_cond_broadcast (&event->cond);
-       mono_os_cond_broadcast (&signal_cond);
+       for (i = 0; i < event->conds->len; ++i)
+               mono_os_cond_signal ((mono_cond_t*) event->conds->pdata [i]);
 
-       mono_os_mutex_unlock (&event->mutex);
        mono_os_mutex_unlock (&signal_mutex);
 }
 
@@ -81,11 +80,11 @@ mono_os_event_reset (MonoOSEvent *event)
 
        g_assert (event);
 
-       mono_os_mutex_lock (&event->mutex);
+       mono_os_mutex_lock (&signal_mutex);
 
        event->signalled = FALSE;
 
-       mono_os_mutex_unlock (&event->mutex);
+       mono_os_mutex_unlock (&signal_mutex);
 }
 
 MonoOSEventWaitRet
@@ -113,41 +112,11 @@ signal_and_unref (gpointer user_data)
        }
 }
 
-static void
-mono_os_event_lock_events (MonoOSEvent **events, gsize nevents)
-{
-       gint i, j;
-
-retry:
-       for (i = 0; i < nevents; ++i) {
-               gint res;
-
-               res = mono_os_mutex_trylock (&events [i]->mutex);
-               if (res != 0) {
-                       for (j = i - 1; j >= 0; j--)
-                               mono_os_mutex_unlock (&events [j]->mutex);
-
-                       mono_thread_info_yield ();
-
-                       goto retry;
-               }
-       }
-}
-
-static void
-mono_os_event_unlock_events (MonoOSEvent **events, gsize nevents)
-{
-       gint i;
-
-       for (i = 0; i < nevents; ++i)
-               mono_os_mutex_unlock (&events [i]->mutex);
-}
-
 MonoOSEventWaitRet
 mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waitall, guint32 timeout)
 {
        MonoOSEventWaitRet ret;
-       MonoOSEvent *innerevents [MONO_OS_EVENT_WAIT_MAXIMUM_OBJECTS + 1];
+       mono_cond_t signal_cond;
        OSEventWaitData *data;
        gboolean alerted;
        gint64 start;
@@ -162,14 +131,10 @@ mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waita
        for (i = 0; i < nevents; ++i)
                g_assert (events [i]);
 
-       memcpy (innerevents, events, sizeof (MonoOSEvent*) * nevents);
-
        data = g_new0 (OSEventWaitData, 1);
        data->ref = 2;
        mono_os_event_init (&data->event, FALSE);
 
-       innerevents [nevents ++] = &data->event;
-
        alerted = FALSE;
        mono_thread_info_install_interrupt (signal_and_unref, data, &alerted);
        if (alerted) {
@@ -181,17 +146,24 @@ mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waita
        if (timeout != MONO_INFINITE_WAIT)
                start = mono_msec_ticks ();
 
+       mono_os_cond_init (&signal_cond);
+
+       mono_os_mutex_lock (&signal_mutex);
+
+       for (i = 0; i < nevents; ++i)
+               g_ptr_array_add (events [i]->conds, &signal_cond);
+
+       g_ptr_array_add (data->event.conds, &signal_cond);
+
        for (;;) {
                gint count, lowest;
                gboolean signalled;
 
-               mono_os_event_lock_events (innerevents, nevents);
-
                count = 0;
                lowest = -1;
 
-               for (i = 0; i < nevents - 1; ++i) {
-                       if (mono_os_event_is_signalled (innerevents [i])) {
+               for (i = 0; i < nevents; ++i) {
+                       if (mono_os_event_is_signalled (events [i])) {
                                count += 1;
                                if (lowest == -1)
                                        lowest = i;
@@ -201,44 +173,15 @@ mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waita
                if (mono_os_event_is_signalled (&data->event))
                        signalled = TRUE;
                else if (waitall)
-                       signalled = (count == nevents - 1);
+                       signalled = (count == nevents);
                else /* waitany */
                        signalled = (count > 0);
 
-               mono_os_event_unlock_events (innerevents, nevents);
-
                if (signalled) {
                        ret = MONO_OS_EVENT_WAIT_RET_SUCCESS_0 + lowest;
                        goto done;
                }
 
-               mono_os_mutex_lock (&signal_mutex);
-
-               if (mono_os_event_is_signalled (&data->event)) {
-                       signalled = TRUE;
-               } else if (waitall) {
-                       signalled = TRUE;
-                       for (i = 0; i < nevents - 1; ++i) {
-                               if (!mono_os_event_is_signalled (innerevents [i])) {
-                                       signalled = FALSE;
-                                       break;
-                               }
-                       }
-               } else {
-                       signalled = FALSE;
-                       for (i = 0; i < nevents - 1; ++i) {
-                               if (mono_os_event_is_signalled (innerevents [i])) {
-                                       signalled = TRUE;
-                                       break;
-                               }
-                       }
-               }
-
-               if (signalled) {
-                       mono_os_mutex_unlock (&signal_mutex);
-                       continue;
-               }
-
                if (timeout == MONO_INFINITE_WAIT) {
                        mono_os_cond_wait (&signal_cond, &signal_mutex);
                } else {
@@ -247,25 +190,28 @@ mono_os_event_wait_multiple (MonoOSEvent **events, gsize nevents, gboolean waita
 
                        elapsed = mono_msec_ticks () - start;
                        if (elapsed >= timeout) {
-                               mono_os_mutex_unlock (&signal_mutex);
-
                                ret = MONO_OS_EVENT_WAIT_RET_TIMEOUT;
                                goto done;
                        }
 
                        res = mono_os_cond_timedwait (&signal_cond, &signal_mutex, timeout - elapsed);
                        if (res != 0) {
-                               mono_os_mutex_unlock (&signal_mutex);
-
                                ret = MONO_OS_EVENT_WAIT_RET_TIMEOUT;
                                goto done;
                        }
                }
-
-               mono_os_mutex_unlock (&signal_mutex);
        }
 
 done:
+       for (i = 0; i < nevents; ++i)
+               g_ptr_array_remove (events [i]->conds, &signal_cond);
+
+       g_ptr_array_remove (data->event.conds, &signal_cond);
+
+       mono_os_mutex_unlock (&signal_mutex);
+
+       mono_os_cond_destroy (&signal_cond);
+
        mono_thread_info_uninstall_interrupt (&alerted);
        if (alerted) {
                if (InterlockedDecrement ((gint32*) &data->ref) == 0) {
index 3f04f0bfcafbbc4554d24431c095928825d80567..c3ca11b8504aa536845b6bca07fbe74a31e5ff9d 100644 (file)
@@ -27,8 +27,7 @@ struct _MonoOSEvent {
 #ifdef HOST_WIN32
        gpointer handle;
 #else
-       mono_mutex_t mutex;
-       mono_cond_t cond;
+       GPtrArray *conds;
        gboolean signalled;
 #endif
 };
index f5a0e9ab98ae02180157b09927d2fccd54f239a3..2251543e666491a794934617bde33931d99d5dfd 100644 (file)
@@ -241,7 +241,6 @@ mono_disasm_code
 mono_disasm_code_one
 mono_dl_fallback_register
 mono_dl_fallback_unregister
-mono_dl_open
 mono_dllmap_insert
 mono_domain_add_class_static_data
 mono_domain_assembly_open
@@ -496,7 +495,6 @@ mono_ldstr
 mono_ldtoken
 mono_load_remote_field
 mono_load_remote_field_new
-mono_loader_register_module
 mono_lock_free_alloc
 mono_lock_free_allocator_check_consistency
 mono_lock_free_allocator_init_allocator
index 1722591c2f397fcd574413a75dd699b8602dcec5..1f82284e7c29e944108087ebb05d2fa117fdac27 100644 (file)
@@ -241,7 +241,6 @@ mono_disasm_code
 mono_disasm_code_one
 mono_dl_fallback_register
 mono_dl_fallback_unregister
-mono_dl_open
 mono_dllmap_insert
 mono_domain_add_class_static_data
 mono_domain_assembly_open
@@ -498,7 +497,6 @@ mono_ldstr
 mono_ldtoken
 mono_load_remote_field
 mono_load_remote_field_new
-mono_loader_register_module
 mono_lock_free_alloc
 mono_lock_free_allocator_check_consistency
 mono_lock_free_allocator_init_allocator