mirror of
https://github.com/farcasclaudiu/SmartThreadPool.git
synced 2026-06-22 11:01:28 +03:00
Renamed method AbortOnWorkItemOnCancel to AbortOnWorkItemCancel
This commit is contained in:
@@ -201,12 +201,12 @@ namespace SmartThreadPoolTests
|
|||||||
/// 2. Queue work item that takes some time
|
/// 2. Queue work item that takes some time
|
||||||
/// 3. Wait for it to start
|
/// 3. Wait for it to start
|
||||||
/// 4. Cancel the work item (soft)
|
/// 4. Cancel the work item (soft)
|
||||||
/// 5. Call to AbortOnWorkItemOnCancel
|
/// 5. Call to AbortOnWorkItemCancel
|
||||||
/// 5. Wait for the STP to get idle
|
/// 5. Wait for the STP to get idle
|
||||||
/// 6. Make sure nothing ran in the work item after the AbortOnWorkItemOnCancel
|
/// 6. Make sure nothing ran in the work item after the AbortOnWorkItemCancel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void CancelInProgressWorkItemSoftWithAbortOnWorkItemOnCancel()
|
public void CancelInProgressWorkItemSoftWithAbortOnWorkItemCancel()
|
||||||
{
|
{
|
||||||
bool abortFailed = false;
|
bool abortFailed = false;
|
||||||
ManualResetEvent waitToStart = new ManualResetEvent(false);
|
ManualResetEvent waitToStart = new ManualResetEvent(false);
|
||||||
@@ -217,7 +217,7 @@ namespace SmartThreadPoolTests
|
|||||||
state => {
|
state => {
|
||||||
waitToStart.Set();
|
waitToStart.Set();
|
||||||
waitToCancel.WaitOne();
|
waitToCancel.WaitOne();
|
||||||
SmartThreadPool.AbortOnWorkItemOnCancel();
|
SmartThreadPool.AbortOnWorkItemCancel();
|
||||||
abortFailed = true;
|
abortFailed = true;
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -125,12 +125,12 @@ namespace SmartThreadPoolTests
|
|||||||
/// 2. Queue work item that takes some time
|
/// 2. Queue work item that takes some time
|
||||||
/// 3. Wait for it to start
|
/// 3. Wait for it to start
|
||||||
/// 4. Cancel the work item (soft)
|
/// 4. Cancel the work item (soft)
|
||||||
/// 5. Call to AbortOnWorkItemOnCancel
|
/// 5. Call to AbortOnWorkItemCancel
|
||||||
/// 5. Wait for the STP to get idle
|
/// 5. Wait for the STP to get idle
|
||||||
/// 6. Make sure nothing ran in the work item after the AbortOnWorkItemOnCancel
|
/// 6. Make sure nothing ran in the work item after the AbortOnWorkItemCancel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void TimeoutInProgressWorkItemSoftWithAbortOnWorkItemOnCancel()
|
public void TimeoutInProgressWorkItemSoftWithAbortOnWorkItemCancel()
|
||||||
{
|
{
|
||||||
bool abortFailed = false;
|
bool abortFailed = false;
|
||||||
ManualResetEvent waitToStart = new ManualResetEvent(false);
|
ManualResetEvent waitToStart = new ManualResetEvent(false);
|
||||||
@@ -143,7 +143,7 @@ namespace SmartThreadPoolTests
|
|||||||
{
|
{
|
||||||
waitToStart.Set();
|
waitToStart.Set();
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
SmartThreadPool.AbortOnWorkItemOnCancel();
|
SmartThreadPool.AbortOnWorkItemCancel();
|
||||||
abortFailed = true;
|
abortFailed = true;
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1347,7 +1347,7 @@ namespace Amib.Threading
|
|||||||
/// Checks if the work item has been cancelled, and if yes then abort the thread.
|
/// Checks if the work item has been cancelled, and if yes then abort the thread.
|
||||||
/// Can be used with Cancel and timeout
|
/// Can be used with Cancel and timeout
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void AbortOnWorkItemOnCancel()
|
public static void AbortOnWorkItemCancel()
|
||||||
{
|
{
|
||||||
if (IsWorkItemCanceled)
|
if (IsWorkItemCanceled)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user