You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
2007-09-05 Atsushi Enomoto <atsushi@ximian.com>
|
||||
|
||||
* HandleCollector.cs : new file.
|
||||
|
||||
2007-03-12 Raja R Harinath <rharinath@novell.com>
|
||||
|
||||
* StandardOleMarshalObject.cs: New .net2.0 class.
|
||||
* DefaultParameterValueAttribute.cs: Move here from corlib.
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// System.Runtime.InteropServices.DefaultParameterValueAttribute.cs
|
||||
//
|
||||
// Author: Zoltan Varga (vargaz@gmail.com)
|
||||
//
|
||||
// (C) Ximian, Inc.
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.Runtime.InteropServices {
|
||||
[AttributeUsage (AttributeTargets.Parameter)]
|
||||
public sealed class DefaultParameterValueAttribute : Attribute
|
||||
{
|
||||
object value;
|
||||
|
||||
public DefaultParameterValueAttribute (object value)
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public object Value {
|
||||
get {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,98 +0,0 @@
|
||||
//
|
||||
// HandleCollector.cs
|
||||
//
|
||||
// Author: Atsushi Enomoto <atsushi@ximian.com>
|
||||
//
|
||||
// Copyright (C) 2007 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
|
||||
namespace System.Runtime.InteropServices
|
||||
{
|
||||
public sealed class HandleCollector
|
||||
{
|
||||
int count;
|
||||
readonly int init, max;
|
||||
readonly string name;
|
||||
DateTime previous_collection = DateTime.MinValue;
|
||||
|
||||
public HandleCollector (string name, int initialThreshold)
|
||||
: this (name, initialThreshold, int.MaxValue)
|
||||
{
|
||||
}
|
||||
|
||||
public HandleCollector (string name, int initialThreshold, int maximumThreshold)
|
||||
{
|
||||
if (initialThreshold < 0)
|
||||
throw new ArgumentOutOfRangeException ("initialThreshold", "initialThreshold must not be less than zero");
|
||||
if (maximumThreshold < 0)
|
||||
throw new ArgumentOutOfRangeException ("maximumThreshold", "maximumThreshold must not be less than zero");
|
||||
if (maximumThreshold < initialThreshold)
|
||||
throw new ArgumentException ("maximumThreshold must not be less than initialThreshold");
|
||||
|
||||
this.name = name;
|
||||
init = initialThreshold;
|
||||
max = maximumThreshold;
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get { return count; }
|
||||
}
|
||||
|
||||
public int InitialThreshold {
|
||||
get { return init; }
|
||||
}
|
||||
|
||||
public int MaximumThreshold {
|
||||
get { return max; }
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
public void Add ()
|
||||
{
|
||||
/* NET_3_5
|
||||
if (++count >= max)
|
||||
GC.Collect (GC.MaxGeneration, GCCollectionMode.Forced);
|
||||
else if (count >= init)
|
||||
GC.Collect (GC.MaxGeneration, GCCollectionMode.Optimized);
|
||||
*/
|
||||
if (++count >= max)
|
||||
GC.Collect (GC.MaxGeneration);
|
||||
else if (count >= init && DateTime.Now - previous_collection > TimeSpan.FromSeconds (5)) { // some arbitrary criteria
|
||||
GC.Collect (GC.MaxGeneration);
|
||||
previous_collection = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
public void Remove ()
|
||||
{
|
||||
if (count == 0)
|
||||
throw new InvalidOperationException ("Cannot call Remove method when Count is 0");
|
||||
count--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user