mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 01:41:17 -10:00
Compare commits
16
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14f2c814cc | ||
|
|
1e2ec7d8db | ||
|
|
adb727509c | ||
|
|
5313a669a7 | ||
|
|
c75bcfe270 | ||
|
|
2a6502cee0 | ||
|
|
02457c20fc | ||
|
|
5e05cafc6f | ||
|
|
73fd9a1b82 | ||
|
|
da80840ea5 | ||
|
|
447a74e440 | ||
|
|
ef39d08daf | ||
|
|
df66c66353 | ||
|
|
b3d1b69247 | ||
|
|
3b924c60cc | ||
|
|
3d531ba625 |
No files matched your search
+1
-1
@@ -1949,7 +1949,7 @@ if test x$host_win32 = xno; then
|
||||
AC_CHECK_HEADERS(pthread.h)
|
||||
AC_CHECK_HEADERS(pthread_np.h)
|
||||
AC_CHECK_FUNCS(pthread_mutex_timedlock)
|
||||
AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np pthread_setname_np pthread_cond_timedwait_relative_np)
|
||||
AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np pthread_setname_np)
|
||||
AC_CHECK_FUNCS(pthread_kill)
|
||||
AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
|
||||
AC_TRY_COMPILE([ #include <pthread.h>], [
|
||||
|
||||
Vendored
+1
-1
Submodule external/cecil updated: 1003fcb375...362e2bb00f.
@@ -375,8 +375,9 @@ namespace System.Net.Http
|
||||
|
||||
wrequest.ResendContentFactory = content.CopyTo;
|
||||
|
||||
var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false);
|
||||
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
|
||||
using (var stream = await wrequest.GetRequestStreamAsync ().ConfigureAwait (false)) {
|
||||
await request.Content.CopyToAsync (stream).ConfigureAwait (false);
|
||||
}
|
||||
} else if (HttpMethod.Post.Equals (request.Method) || HttpMethod.Put.Equals (request.Method) || HttpMethod.Delete.Equals (request.Method)) {
|
||||
// Explicitly set this to make sure we're sending a "Content-Length: 0" header.
|
||||
// This fixes the issue that's been reported on the forums:
|
||||
|
||||
@@ -482,8 +482,7 @@ namespace System.Diagnostics
|
||||
if (proc == IntPtr.Zero)
|
||||
throw new ArgumentException ("Can't find process with ID " + processId.ToString ());
|
||||
|
||||
/* The handle returned by GetProcess_internal is owned by its called, so we must pass true to SafeProcessHandle */
|
||||
return (new Process (new SafeProcessHandle (proc, true), processId));
|
||||
return (new Process (new SafeProcessHandle (proc, false), processId));
|
||||
}
|
||||
|
||||
public static Process[] GetProcessesByName(string processName, string machineName)
|
||||
|
||||
@@ -741,7 +741,7 @@ namespace System.Runtime.InteropServices
|
||||
#else
|
||||
public static bool IsComObject (object o)
|
||||
{
|
||||
throw new PlatformNotSupportedException ();
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -387,7 +387,7 @@ worker_park (void)
|
||||
gboolean timeout = FALSE;
|
||||
gboolean interrupted = FALSE;
|
||||
|
||||
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker parking", mono_native_thread_id_get ());
|
||||
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker parking", mono_native_thread_id_get ());
|
||||
|
||||
mono_coop_mutex_lock (&worker.parked_threads_lock);
|
||||
|
||||
@@ -430,7 +430,7 @@ done:
|
||||
|
||||
mono_coop_mutex_unlock (&worker.parked_threads_lock);
|
||||
|
||||
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s",
|
||||
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker unparking, timeout? %s interrupted? %s",
|
||||
mono_native_thread_id_get (), timeout ? "yes" : "no", interrupted ? "yes" : "no");
|
||||
|
||||
return timeout;
|
||||
@@ -461,7 +461,7 @@ worker_thread (gpointer unused)
|
||||
MonoInternalThread *thread;
|
||||
ThreadPoolWorkerCounter counter;
|
||||
|
||||
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker starting", mono_native_thread_id_get ());
|
||||
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker starting", mono_native_thread_id_get ());
|
||||
|
||||
if (!mono_refcount_tryinc (&worker))
|
||||
return 0;
|
||||
@@ -498,7 +498,7 @@ worker_thread (gpointer unused)
|
||||
counter._.working --;
|
||||
});
|
||||
|
||||
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker finishing", mono_native_thread_id_get ());
|
||||
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] worker finishing", mono_native_thread_id_get ());
|
||||
|
||||
mono_refcount_dec (&worker);
|
||||
|
||||
|
||||
@@ -1314,6 +1314,13 @@ class Tests
|
||||
return RuntimeHelpers.IsReferenceOrContainsReferences<T> ();
|
||||
}
|
||||
|
||||
class IsRefClass<T> {
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public bool is_ref () {
|
||||
return RuntimeHelpers.IsReferenceOrContainsReferences<T> ();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static bool is_ref_or_contains_refs_gen_ref<T> () {
|
||||
return RuntimeHelpers.IsReferenceOrContainsReferences<GenStruct<T>> ();
|
||||
@@ -1343,6 +1350,12 @@ class Tests
|
||||
int i;
|
||||
}
|
||||
|
||||
struct AStruct3<T1, T2, T3> {
|
||||
T1 t1;
|
||||
T2 t2;
|
||||
T3 t3;
|
||||
}
|
||||
|
||||
public static int test_0_isreference_intrins () {
|
||||
if (RuntimeHelpers.IsReferenceOrContainsReferences<int> ())
|
||||
return 1;
|
||||
@@ -1368,6 +1381,14 @@ class Tests
|
||||
if (is_ref_or_contains_refs_gen_noref<string> ())
|
||||
return 10;
|
||||
|
||||
// Complex type from shared class method
|
||||
var c1 = new IsRefClass<AStruct3<int, int, int>> ();
|
||||
if (c1.is_ref ())
|
||||
return 11;
|
||||
var c2 = new IsRefClass<AStruct3<string, int, int>> ();
|
||||
if (!c2.is_ref ())
|
||||
return 12;
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1972,6 +1972,30 @@ public class Tests
|
||||
gsharedvt_vphi (0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct AStruct3<T1, T2, T3> {
|
||||
T1 t1;
|
||||
T2 t2;
|
||||
T3 t3;
|
||||
}
|
||||
|
||||
interface IFaceIsRef {
|
||||
bool is_ref<T> ();
|
||||
}
|
||||
|
||||
class ClassIsRef : IFaceIsRef {
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public bool is_ref<T> () {
|
||||
return RuntimeHelpers.IsReferenceOrContainsReferences<T> ();
|
||||
}
|
||||
}
|
||||
|
||||
public static int test_0_isreference_intrins () {
|
||||
IFaceIsRef iface = new ClassIsRef ();
|
||||
Console.WriteLine ("X: " + iface.is_ref<AStruct3<int, int, int>> ());
|
||||
Console.WriteLine ("X: " + iface.is_ref<AStruct3<string, int, int>> ());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
// #13191
|
||||
|
||||
@@ -5407,11 +5407,15 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
|
||||
g_assert (ctx);
|
||||
g_assert (ctx->method_inst);
|
||||
g_assert (ctx->method_inst->type_argc == 1);
|
||||
MonoType *t = mini_get_underlying_type (ctx->method_inst->type_argv [0]);
|
||||
MonoClass *klass = mono_class_from_mono_type (t);
|
||||
MonoType *arg_type = ctx->method_inst->type_argv [0];
|
||||
MonoType *t;
|
||||
MonoClass *klass;
|
||||
|
||||
ins = NULL;
|
||||
|
||||
/* Resolve the argument class as possible so we can handle common cases fast */
|
||||
t = mini_get_underlying_type (arg_type);
|
||||
klass = mono_class_from_mono_type (t);
|
||||
mono_class_init (klass);
|
||||
if (MONO_TYPE_IS_REFERENCE (t))
|
||||
EMIT_NEW_ICONST (cfg, ins, 1);
|
||||
@@ -5424,10 +5428,12 @@ mini_emit_inst_for_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSign
|
||||
else {
|
||||
g_assert (cfg->gshared);
|
||||
|
||||
int context_used = mini_class_check_context_used (cfg, klass);
|
||||
/* Have to use the original argument class here */
|
||||
MonoClass *arg_class = mono_class_from_mono_type (arg_type);
|
||||
int context_used = mini_class_check_context_used (cfg, arg_class);
|
||||
|
||||
/* This returns 1 or 2 */
|
||||
MonoInst *info = mini_emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_CLASS_IS_REF_OR_CONTAINS_REFS);
|
||||
MonoInst *info = mini_emit_get_rgctx_klass (cfg, context_used, arg_class, MONO_RGCTX_INFO_CLASS_IS_REF_OR_CONTAINS_REFS);
|
||||
int dreg = alloc_ireg (cfg);
|
||||
EMIT_NEW_BIALU_IMM (cfg, ins, OP_ISUB_IMM, dreg, info->dreg, 1);
|
||||
}
|
||||
|
||||
@@ -59,7 +59,6 @@ monoutils_sources = \
|
||||
mono-mmap-internals.h \
|
||||
mono-mmap-windows-internals.h \
|
||||
mono-os-mutex.h \
|
||||
mono-os-mutex.c \
|
||||
mono-coop-mutex.h \
|
||||
mono-once.h \
|
||||
mono-lazy-init.h \
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
/**
|
||||
* \file
|
||||
* Portability wrappers around POSIX Mutexes
|
||||
*
|
||||
* Authors: Jeffrey Stedfast <[email protected]>
|
||||
*
|
||||
* Copyright 2002 Ximian, Inc. (www.ximian.com)
|
||||
*
|
||||
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#if !defined(HOST_WIN32)
|
||||
|
||||
#if defined(TARGET_OSX)
|
||||
/* So we can use the declaration of pthread_cond_timedwait_relative_np () */
|
||||
#undef _XOPEN_SOURCE
|
||||
#endif
|
||||
#include <pthread.h>
|
||||
|
||||
#include "mono-os-mutex.h"
|
||||
|
||||
int
|
||||
mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_ms)
|
||||
{
|
||||
struct timespec ts;
|
||||
int res;
|
||||
|
||||
if (timeout_ms == MONO_INFINITE_WAIT) {
|
||||
mono_os_cond_wait (cond, mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ms = 10^-3, us = 10^-6, ns = 10^-9 */
|
||||
|
||||
/* This function only seems to be available on 64bit osx */
|
||||
#if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP) && defined(TARGET_OSX)
|
||||
memset (&ts, 0, sizeof (struct timespec));
|
||||
ts.tv_sec = timeout_ms / 1000;
|
||||
ts.tv_nsec = (timeout_ms % 1000) * 1000 * 1000;
|
||||
|
||||
res = pthread_cond_timedwait_relative_np (cond, mutex, &ts);
|
||||
if (G_UNLIKELY (res != 0 && res != ETIMEDOUT)) {
|
||||
g_print ("cond: %p mutex: %p\n", *(gpointer*)cond, *(gpointer*)mutex);
|
||||
g_error ("%s: pthread_cond_timedwait_relative_np failed with \"%s\" (%d) %ld %ld %d", __func__, g_strerror (res), res, ts.tv_sec, ts.tv_nsec, timeout_ms);
|
||||
}
|
||||
return res != 0 ? -1 : 0;
|
||||
#else
|
||||
#ifdef BROKEN_CLOCK_SOURCE
|
||||
struct timeval tv;
|
||||
|
||||
/* clock_gettime is not supported in MAC OS x */
|
||||
res = gettimeofday (&tv, NULL);
|
||||
if (G_UNLIKELY (res != 0))
|
||||
g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
|
||||
|
||||
ts.tv_sec = tv.tv_sec;
|
||||
ts.tv_nsec = tv.tv_usec * 1000;
|
||||
#else
|
||||
/* cond is using CLOCK_MONOTONIC as time source */
|
||||
res = clock_gettime (CLOCK_MONOTONIC, &ts);
|
||||
if (G_UNLIKELY (res != 0))
|
||||
g_error ("%s: clock_gettime failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
|
||||
#endif
|
||||
|
||||
ts.tv_sec += timeout_ms / 1000;
|
||||
ts.tv_nsec += (timeout_ms % 1000) * 1000 * 1000;
|
||||
if (ts.tv_nsec >= 1000 * 1000 * 1000) {
|
||||
ts.tv_nsec -= 1000 * 1000 * 1000;
|
||||
ts.tv_sec ++;
|
||||
}
|
||||
|
||||
res = pthread_cond_timedwait (cond, mutex, &ts);
|
||||
if (G_UNLIKELY (res != 0 && res != ETIMEDOUT)) {
|
||||
g_print ("cond: %p mutex: %p\n", *(gpointer*)cond, *(gpointer*)mutex);
|
||||
g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d) %ld %ld %d", __func__, g_strerror (res), res, ts.tv_sec, ts.tv_nsec, timeout_ms);
|
||||
}
|
||||
return res != 0 ? -1 : 0;
|
||||
#endif /* !HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP */
|
||||
}
|
||||
|
||||
#endif /* HOST_WIN32 */
|
||||
@@ -175,8 +175,50 @@ mono_os_cond_wait (mono_cond_t *cond, mono_mutex_t *mutex)
|
||||
g_error ("%s: pthread_cond_wait failed with \"%s\" (%d)", __func__, g_strerror (res), res);
|
||||
}
|
||||
|
||||
int
|
||||
mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_ms);
|
||||
static inline int
|
||||
mono_os_cond_timedwait (mono_cond_t *cond, mono_mutex_t *mutex, guint32 timeout_ms)
|
||||
{
|
||||
#ifdef BROKEN_CLOCK_SOURCE
|
||||
struct timeval tv;
|
||||
#endif
|
||||
struct timespec ts;
|
||||
int res;
|
||||
|
||||
if (timeout_ms == MONO_INFINITE_WAIT) {
|
||||
mono_os_cond_wait (cond, mutex);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* ms = 10^-3, us = 10^-6, ns = 10^-9 */
|
||||
|
||||
#ifdef BROKEN_CLOCK_SOURCE
|
||||
/* clock_gettime is not supported in MAC OS x */
|
||||
res = gettimeofday (&tv, NULL);
|
||||
if (G_UNLIKELY (res != 0))
|
||||
g_error ("%s: gettimeofday failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
|
||||
|
||||
ts.tv_sec = tv.tv_sec;
|
||||
ts.tv_nsec = tv.tv_usec * 1000;
|
||||
#else
|
||||
/* cond is using CLOCK_MONOTONIC as time source */
|
||||
res = clock_gettime (CLOCK_MONOTONIC, &ts);
|
||||
if (G_UNLIKELY (res != 0))
|
||||
g_error ("%s: clock_gettime failed with \"%s\" (%d)", __func__, g_strerror (errno), errno);
|
||||
#endif
|
||||
|
||||
ts.tv_sec += timeout_ms / 1000;
|
||||
ts.tv_nsec += (timeout_ms % 1000) * 1000 * 1000;
|
||||
if (ts.tv_nsec >= 1000 * 1000 * 1000) {
|
||||
ts.tv_nsec -= 1000 * 1000 * 1000;
|
||||
ts.tv_sec ++;
|
||||
}
|
||||
|
||||
res = pthread_cond_timedwait (cond, mutex, &ts);
|
||||
if (G_UNLIKELY (res != 0 && res != ETIMEDOUT))
|
||||
g_error ("%s: pthread_cond_timedwait failed with \"%s\" (%d) %ld %ld %d", __func__, g_strerror (res), res, ts.tv_sec, ts.tv_nsec, timeout_ms);
|
||||
|
||||
return res != 0 ? -1 : 0;
|
||||
}
|
||||
|
||||
static inline void
|
||||
mono_os_cond_signal (mono_cond_t *cond)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
@@ -109,7 +109,6 @@
|
||||
<ClCompile Include="..\mono\utils\mono-uri.c" />
|
||||
<ClCompile Include="..\mono\utils\mono-value-hash.c" />
|
||||
<ClCompile Include="..\mono\utils\monobitset.c" />
|
||||
<ClCompile Include="..\mono\utils\mono-os-mutex.c" />
|
||||
<ClCompile Include="..\mono\utils\os-event-win32.c" />
|
||||
<ClCompile Include="..\mono\utils\strenc.c" />
|
||||
<ClCompile Include="..\mono\utils\atomic.c" />
|
||||
|
||||
Reference in new issue
Block a user