You've already forked linux-packaging-mono
Imported Upstream version 6.0.0.172
Former-commit-id: f3cc9b82f3e5bd8f0fd3ebc098f789556b44e9cd
This commit is contained in:
parent
8016999e4d
commit
64ac736ec5
@ -29,47 +29,13 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System {
|
||||
|
||||
[TestFixture]
|
||||
public class GCTest {
|
||||
static class FinalizerHelpers {
|
||||
private static IntPtr aptr;
|
||||
|
||||
private static unsafe void NoPinActionHelper (int depth, Action act)
|
||||
{
|
||||
// Avoid tail calls
|
||||
int* values = stackalloc int [20];
|
||||
aptr = new IntPtr (values);
|
||||
|
||||
if (depth <= 0) {
|
||||
//
|
||||
// When the action is called, this new thread might have not allocated
|
||||
// anything yet in the nursery. This means that the address of the first
|
||||
// object that would be allocated would be at the start of the tlab and
|
||||
// implicitly the end of the previous tlab (address which can be in use
|
||||
// when allocating on another thread, at checking if an object fits in
|
||||
// this other tlab). We allocate a new dummy object to avoid this type
|
||||
// of false pinning for most common cases.
|
||||
//
|
||||
new object ();
|
||||
act ();
|
||||
} else {
|
||||
NoPinActionHelper (depth - 1, act);
|
||||
}
|
||||
}
|
||||
|
||||
public static void PerformNoPinAction (Action act)
|
||||
{
|
||||
Thread thr = new Thread (() => NoPinActionHelper (128, act));
|
||||
thr.Start ();
|
||||
thr.Join ();
|
||||
}
|
||||
}
|
||||
|
||||
class MyFinalizeObject
|
||||
{
|
||||
public volatile static int finalized;
|
||||
@ -89,6 +55,7 @@ namespace MonoTests.System {
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("MultiThreaded")]
|
||||
public void ReRegisterForFinalizeTest ()
|
||||
{
|
||||
FinalizerHelpers.PerformNoPinAction (delegate () {
|
||||
|
Reference in New Issue
Block a user