Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Stact.Specs/Channels/ConsumerInstance_Specs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ namespace Stact.Specs.Channels
using NUnit.Framework;
using Rhino.Mocks;
using Magnum.TestFramework;
using System.Threading.Tasks;


[TestFixture]
Expand Down Expand Up @@ -109,7 +110,7 @@ public void Should_work_for_thread_static_instances()
var second = new Future<bool>();
var started = new Future<bool>();

ThreadPool.QueueUserWorkItem(x =>
Task.Factory.StartNew(() =>
{
channel.Send(message);
started.Complete(true);
Expand All @@ -120,7 +121,7 @@ public void Should_work_for_thread_static_instances()

started.WaitUntilCompleted(5.Seconds());

ThreadPool.QueueUserWorkItem(x =>
Task.Factory.StartNew(() =>
{
channel.Send(message);
second.Complete(true);
Expand Down
2 changes: 1 addition & 1 deletion src/Stact.Specs/Channels/ThreadPoolChannel_Specs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void Should_not_allow_more_than_the_specified_number_of_consumers()

Trace.WriteLine("Sending extra message to try and break it");

ThreadPool.QueueUserWorkItem(x =>
Task.Factory.StartNew(() =>
channel.Send(new TestMessage(() =>
{
lock (locker)
Expand Down
3 changes: 2 additions & 1 deletion src/Stact/Channels/ThreadPoolChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Stact
{
using System;
using System.Threading;
using System.Threading.Tasks;


/// <summary>
Expand Down Expand Up @@ -51,7 +52,7 @@ public void Send(T message)

_channelCount++;

ThreadPool.QueueUserWorkItem(x => SendMessageToChannel(message));
Task.Factory.StartNew(() => SendMessageToChannel(message));
}
}

Expand Down