Skip to content

Commit 66f499a

Browse files
authored
Merge pull request #1388 from rabbitmq/rabbitmq-dotnet-client-1355
Start main reader loop using the default TaskScheduler
2 parents 6677851 + b502081 commit 66f499a

File tree

4 files changed

+8
-72
lines changed

4 files changed

+8
-72
lines changed

projects/RabbitMQ.Client/client/api/ConnectionFactory.cs

+2
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,9 @@ public ICredentialsProvider CredentialsProvider
428428

429429
/// <summary>
430430
/// When set to true, background thread will be used for the I/O loop.
431+
/// NB: No-op
431432
/// </summary>
433+
[Obsolete("Currently a no-op. UseBackgroundThreadsForIO will be removed in version 7")]
432434
public bool UseBackgroundThreadsForIO { get; set; }
433435

434436
/// <summary>

projects/RabbitMQ.Client/client/impl/Connection.cs

+5-3
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ public Connection(IConnectionFactory factory, bool insist, IFrameHandler frameHa
116116
_session0 = new MainSession(this) { Handler = NotifyReceivedCloseOk };
117117
_model0 = (ModelBase)Protocol.CreateModel(_session0);
118118

119-
StartMainLoop(factory.UseBackgroundThreadsForIO);
119+
StartMainLoop();
120+
120121
try
121122
{
122123
Open(insist);
@@ -848,9 +849,10 @@ public void MaybeStartHeartbeatTimers()
848849
}
849850
}
850851

851-
public void StartMainLoop(bool useBackgroundThread)
852+
public void StartMainLoop()
852853
{
853-
_mainLoopTask = Task.Factory.StartNew(MainLoop, TaskCreationOptions.LongRunning | TaskCreationOptions.DenyChildAttach);
854+
TaskCreationOptions opts = TaskCreationOptions.LongRunning | TaskCreationOptions.DenyChildAttach;
855+
_mainLoopTask = Task.Factory.StartNew(MainLoop, CancellationToken.None, opts, TaskScheduler.Default);
854856
}
855857

856858
public void HeartbeatReadTimerCallback(object state)

projects/Unit/APIApproval.Approve.verified.txt

+1
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ namespace RabbitMQ.Client
121121
public RabbitMQ.Client.TopologyRecoveryExceptionHandler TopologyRecoveryExceptionHandler { get; set; }
122122
public RabbitMQ.Client.TopologyRecoveryFilter TopologyRecoveryFilter { get; set; }
123123
public System.Uri Uri { get; set; }
124+
[System.Obsolete("Currently a no-op. UseBackgroundThreadsForIO will be removed in version 7")]
124125
public bool UseBackgroundThreadsForIO { get; set; }
125126
public string UserName { get; set; }
126127
public string VirtualHost { get; set; }

projects/Unit/TestConnectionWithBackgroundThreads.cs

-69
This file was deleted.

0 commit comments

Comments
 (0)