diff --git a/src/Adaptive.Aeron/Aeron.cs b/src/Adaptive.Aeron/Aeron.cs index aa14d100..1fa392c4 100644 --- a/src/Adaptive.Aeron/Aeron.cs +++ b/src/Adaptive.Aeron/Aeron.cs @@ -135,7 +135,7 @@ public Subscription AddSubscription(string channel, int streamId) private Aeron Start() { - AgentRunner.StartOnThread(_conductorRunner); + AgentRunner.StartOnThread(_conductorRunner, _ctx.ThreadFactory()); return this; } @@ -168,6 +168,7 @@ public class Context : IDisposable private UnsafeBuffer _countersMetaDataBuffer; private UnsafeBuffer _countersValuesBuffer; private MapMode _imageMapMode = MapMode.ReadOnly; + private IThreadFactory threadFactory = new DefaultThreadFactory(); /// /// The top level Aeron directory used for communication between a Media Driver and client. @@ -524,6 +525,26 @@ public Context ImageMapMode(MapMode imageMapMode) return this; } + /// + /// Specify the thread factory to use when starting the conductor thread. + /// + /// thread factory to construct the thread. + /// this for a fluent API. + public Context ThreadFactory(IThreadFactory threadFactory) + { + this.threadFactory = threadFactory; + return this; + } + + /// + /// The thread factory to be use to construct the conductor thread + /// + /// the specified thread factory of if none is provided. + public IThreadFactory ThreadFactory() + { + return threadFactory; + } + /// /// Return the timeout, in milliseconds, that this client will use to determine if a /// has active subscribers or not.