You've already forked linux-packaging-mono
Imported Upstream version 4.6.0.150
Former-commit-id: 73e3bb1e96dd09dc931c1dfe559d2c7f7b8b02c7
This commit is contained in:
parent
02ac915603
commit
b95516a3dd
@@ -1 +1 @@
|
||||
86ddead705be331233d7cfe59820943b3583a497
|
||||
9fbac024ad6e85933d31c735232b407130f89f93
|
||||
@@ -824,7 +824,7 @@ EXTRA_DIST = TestDriver.cs \
|
||||
Makefile.am.in
|
||||
|
||||
version.h: Makefile
|
||||
echo "#define FULL_VERSION \"Stable 4.6.0.127/0cb79a3\"" > version.h
|
||||
echo "#define FULL_VERSION \"Stable 4.6.0.150/d0fc1a6\"" > version.h
|
||||
|
||||
# Utility target for patching libtool to speed up linking
|
||||
patch-libtool:
|
||||
|
||||
@@ -824,7 +824,7 @@ EXTRA_DIST = TestDriver.cs \
|
||||
Makefile.am.in
|
||||
|
||||
version.h: Makefile
|
||||
echo "#define FULL_VERSION \"Stable 4.6.0.127/0cb79a3\"" > version.h
|
||||
echo "#define FULL_VERSION \"Stable 4.6.0.150/d0fc1a6\"" > version.h
|
||||
|
||||
# Utility target for patching libtool to speed up linking
|
||||
patch-libtool:
|
||||
|
||||
@@ -1 +1 @@
|
||||
c1e1b34c9105e7efd98ab45e605956855423163d
|
||||
8661c97fc5b49dd62fa3c458b6a8636dacd3a88d
|
||||
@@ -1 +1 @@
|
||||
#define FULL_VERSION "Stable 4.6.0.127/0cb79a3"
|
||||
#define FULL_VERSION "Stable 4.6.0.150/d0fc1a6"
|
||||
|
||||
@@ -1105,6 +1105,49 @@ public class Tests {
|
||||
return res;
|
||||
}
|
||||
|
||||
class Worker {
|
||||
volatile bool stop = false;
|
||||
public void Stop () {
|
||||
stop = true;
|
||||
}
|
||||
|
||||
public void Work () {
|
||||
while (!stop) {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
var a = new double[80000];
|
||||
Thread.Sleep (0);
|
||||
}
|
||||
GC.Collect ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int test_43_thread_attach_detach_contested () {
|
||||
// Test plan: we want to create a race between the GC
|
||||
// and native threads detaching. When a native thread
|
||||
// calls a managed delegate, it's attached to the
|
||||
// runtime by the wrapper. It is detached when the
|
||||
// thread is destroyed and the TLS key destructor for
|
||||
// MonoThreadInfo runs. That destructor wants to take
|
||||
// the GC lock. So we create a lot of native threads
|
||||
// while at the same time running a worker that
|
||||
// allocates garbage and invokes the collector.
|
||||
var w = new Worker ();
|
||||
Thread t = new Thread(new ThreadStart (w.Work));
|
||||
t.Start ();
|
||||
|
||||
for (int count = 0; count < 500; count++) {
|
||||
int res = mono_test_marshal_thread_attach (delegate (int i) {
|
||||
Thread.Sleep (0);
|
||||
return i + 1;
|
||||
});
|
||||
}
|
||||
Thread.Sleep (1000);
|
||||
w.Stop ();
|
||||
t.Join ();
|
||||
return 43;
|
||||
|
||||
}
|
||||
/*
|
||||
* Appdomain save/restore
|
||||
*/
|
||||
|
||||
@@ -282,7 +282,7 @@ MonoSelfSupendResult
|
||||
mono_threads_transition_state_poll (MonoThreadInfo *info)
|
||||
{
|
||||
int raw_state, cur_state, suspend_count;
|
||||
g_assert (info == mono_thread_info_current ());
|
||||
g_assert (mono_thread_info_is_current (info));
|
||||
|
||||
retry_state_change:
|
||||
UNWRAP_THREAD_STATE (raw_state, cur_state, suspend_count, info);
|
||||
|
||||
@@ -398,6 +398,8 @@ unregister_thread (void *arg)
|
||||
|
||||
info = (MonoThreadInfo *) arg;
|
||||
g_assert (info);
|
||||
g_assert (mono_thread_info_is_current (info));
|
||||
g_assert (mono_thread_info_is_live (info));
|
||||
|
||||
small_id = info->small_id;
|
||||
|
||||
@@ -633,6 +635,20 @@ mono_thread_info_is_exiting (void)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef HOST_WIN32
|
||||
static void
|
||||
thread_info_key_dtor (void *arg)
|
||||
{
|
||||
/* Put the MonoThreadInfo back for the duration of the
|
||||
* unregister code. In some circumstances the thread needs to
|
||||
* take the GC lock which may block which requires a coop
|
||||
* state transition. */
|
||||
mono_native_tls_set_value (thread_info_key, arg);
|
||||
unregister_thread (arg);
|
||||
mono_native_tls_set_value (thread_info_key, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
|
||||
{
|
||||
@@ -643,7 +659,7 @@ mono_threads_init (MonoThreadInfoCallbacks *callbacks, size_t info_size)
|
||||
res = mono_native_tls_alloc (&thread_info_key, NULL);
|
||||
res = mono_native_tls_alloc (&thread_exited_key, NULL);
|
||||
#else
|
||||
res = mono_native_tls_alloc (&thread_info_key, (void *) unregister_thread);
|
||||
res = mono_native_tls_alloc (&thread_info_key, (void *) thread_info_key_dtor);
|
||||
res = mono_native_tls_alloc (&thread_exited_key, (void *) thread_exited_dtor);
|
||||
#endif
|
||||
|
||||
@@ -1010,6 +1026,8 @@ static void
|
||||
mono_thread_info_suspend_lock_with_info (MonoThreadInfo *info)
|
||||
{
|
||||
g_assert (info);
|
||||
g_assert (mono_thread_info_is_current (info));
|
||||
g_assert (mono_thread_info_is_live (info));
|
||||
|
||||
MONO_ENTER_GC_SAFE_WITH_INFO(info);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user