Skip to content

Commit 07681d2

Browse files
authored
Update NetMQPoller.cs
Adding additional option
1 parent f75ba8d commit 07681d2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/NetMQ/NetMQPoller.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ public Task<bool> ContainsAsync(Socket socket)
408408
#endregion
409409

410410
#region Start / Stop
411-
411+
412412
/// <summary>
413413
/// Runs the poller in a background thread, returning once the poller has started.
414414
/// </summary>
@@ -424,15 +424,16 @@ public void RunAsync()
424424
/// Runs the poller in a background thread, returning once the poller has started.
425425
/// </summary>
426426
/// <param name="threadName">The thread name to use.</param>
427-
public void RunAsync(string threadName)
427+
/// <param name="foregroundPoller">Allow the poller thread to be a foreground thread/background.</param>
428+
public void RunAsync(string threadName, bool foregroundPoller=true)
428429
{
429430
CheckDisposed();
430431
if (IsRunning)
431432
throw new InvalidOperationException("NetMQPoller is already running");
432433

433434
var thread = new Thread(Run) {
434435
Name = threadName,
435-
IsBackground = true
436+
IsBackground = !foregroundPoller
436437
};
437438
thread.Start();
438439

0 commit comments

Comments
 (0)