You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
900 B
38 lines
900 B
5 years ago
|
#if NET20 || NET30 || NET35 || !NET_4_6
|
||
|
|
||
|
using System.Security;
|
||
|
|
||
|
namespace System.Threading
|
||
|
{
|
||
|
internal interface IThreadPoolWorkItem
|
||
|
{
|
||
|
[SecurityCritical]
|
||
|
void ExecuteWorkItem();
|
||
|
|
||
|
[SecurityCritical]
|
||
|
void MarkAborted(ThreadAbortException exception);
|
||
|
}
|
||
|
|
||
|
internal static class ThreadPoolAdapter
|
||
|
{
|
||
|
internal static void QueueWorkItem(IThreadPoolWorkItem item)
|
||
|
{
|
||
|
ThreadPool.QueueUserWorkItem
|
||
|
(
|
||
|
_ =>
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
item.ExecuteWorkItem();
|
||
|
}
|
||
|
catch (ThreadAbortException exception)
|
||
|
{
|
||
|
item.MarkAborted(exception);
|
||
|
}
|
||
|
}
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#endif
|