mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-19 00:20:25 +02:00
Got rid of Action<T>/Func<T>
This commit is contained in:
parent
44bd9c698f
commit
b52db47d55
37 changed files with 94 additions and 88 deletions
|
@ -1,10 +0,0 @@
|
|||
namespace System
|
||||
{
|
||||
public delegate void Action();
|
||||
public delegate void Action<T>(T obj);
|
||||
public delegate void Action<T1, T2>(T1 p1, T2 p2);
|
||||
public delegate void Action<T1, T2, T3>(T1 p1, T2 p2, T3 p3);
|
||||
public delegate void Action<T1, T2, T3, T4>(T1 p1, T2 p2, T3 p3, T4 p4);
|
||||
|
||||
public delegate int Comparison<T>(T lhs, T rhs);
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
namespace System.Collections
|
||||
{
|
||||
|
||||
}
|
|
@ -39,6 +39,8 @@ namespace System
|
|||
}
|
||||
}
|
||||
|
||||
delegate void Action();
|
||||
|
||||
struct Function : int
|
||||
{
|
||||
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
namespace System
|
||||
{
|
||||
delegate TResult Func<TResult>();
|
||||
delegate TResult Func<T1, TResult>(T1 p1);
|
||||
delegate TResult Func<T1, T2, TResult>(T1 p1, T2 p2);
|
||||
delegate TResult Func<T1, T2, T3, TResult>(T1 p1, T2 p2, T3 p3);
|
||||
}
|
|
@ -72,4 +72,6 @@ namespace System
|
|||
{
|
||||
|
||||
}
|
||||
|
||||
public delegate int Comparison<T>(T lhs, T rhs);
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ namespace System.IO
|
|||
|
||||
public this(
|
||||
bool isRead,
|
||||
Func<Object, int> func, Object state,
|
||||
delegate int(Object) func, Object state,
|
||||
Stream stream, uint8[] buffer, int offset, int count, AsyncCallback callback) :
|
||||
base(func, state, CancellationToken.None, TaskCreationOptions.DenyChildAttach)
|
||||
{
|
||||
|
|
|
@ -32,7 +32,7 @@ namespace System.Threading.Tasks
|
|||
|
||||
}
|
||||
|
||||
public this(Func<Object, TResult> func, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
|
||||
public this(delegate TResult(Object) func, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
|
||||
: this(func, state, Task.[Friend]InternalCurrentIfAttached(creationOptions), cancellationToken,
|
||||
creationOptions, InternalTaskOptions.None, null)
|
||||
{
|
||||
|
@ -40,7 +40,7 @@ namespace System.Threading.Tasks
|
|||
//PossiblyCaptureContext(ref stackMark);
|
||||
}
|
||||
|
||||
this(Func<TResult> valueSelector, Task parent, CancellationToken cancellationToken,
|
||||
this(delegate TResult() valueSelector, Task parent, CancellationToken cancellationToken,
|
||||
TaskCreationOptions creationOptions, InternalTaskOptions internalOptions, TaskScheduler scheduler) :
|
||||
base(valueSelector, null, parent, cancellationToken, creationOptions, internalOptions, scheduler)
|
||||
{
|
||||
|
@ -103,9 +103,9 @@ namespace System.Threading.Tasks
|
|||
return m_result;
|
||||
}
|
||||
|
||||
List<Action<Task<TResult>>> mContinuations = new List<Action<Task<TResult>>>() ~ delete _;
|
||||
List<delegate void(Task<TResult>)> mContinuations = new .() ~ delete _;
|
||||
|
||||
public Task ContinueWith(Action<Task<TResult>> continuationAction)
|
||||
public Task ContinueWith(delegate void(Task<TResult>) continuationAction)
|
||||
{
|
||||
bool callDirectly = false;
|
||||
using (mMonitor.Enter())
|
||||
|
@ -130,7 +130,7 @@ namespace System.Threading.Tasks
|
|||
|
||||
public void Notify(bool allowDelete = true)
|
||||
{
|
||||
var continueList = scope List<Action<Task<TResult>>>(16);
|
||||
var continueList = scope List<delegate void(Task<TResult>)>(16);
|
||||
using (mMonitor.Enter())
|
||||
{
|
||||
mHasCompleted = true;
|
||||
|
|
|
@ -255,7 +255,7 @@ namespace System.Threading.Tasks
|
|||
|
||||
}
|
||||
|
||||
public this(Action<Object> action, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
|
||||
public this(delegate void(Object) action, Object state, CancellationToken cancellationToken, TaskCreationOptions creationOptions)
|
||||
: this(action, state, Task.InternalCurrentIfAttached(creationOptions), cancellationToken, creationOptions, InternalTaskOptions.None, null)
|
||||
{
|
||||
//StackCrawlMark stackMark = StackCrawlMark.LookForMyCaller;
|
||||
|
@ -1121,7 +1121,7 @@ namespace System.Threading.Tasks
|
|||
action();
|
||||
return;
|
||||
}
|
||||
var actionWithState = m_action as Action<Object>;
|
||||
var actionWithState = m_action as delegate void(Object);
|
||||
if (actionWithState != null)
|
||||
{
|
||||
actionWithState(m_stateObject);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue