Skip to content

Commit

Permalink
use background thread to wait for address changes on OSX (dotnet/core…
Browse files Browse the repository at this point in the history
…fx#41768)

* use background thread to wait for address changes on OSX

* remove RemoteExecutor

* update comment


Commit migrated from dotnet/corefx@08bf1fe
  • Loading branch information
wfurt authored Oct 16, 2019
1 parent b620e32 commit 3154b76
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ private static unsafe void CreateAndStartRunLoop()
}
}
s_runLoopThread = new Thread(RunLoopThreadStart);
s_runLoopThread.IsBackground = true;
s_runLoopThread.Start();
s_runLoopStartedEvent.WaitOne(); // Wait for the new thread to finish initialization.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,20 @@ public void NetworkAvailabilityChanged_JustRemove_Success()
NetworkChange.NetworkAvailabilityChanged -= _availabilityHandler;
}

[Fact]
[ActiveIssue(33530, TestPlatforms.FreeBSD)]
public void NetworkAddressChanged_Add_DoesNotBlock()
{
// Register without unregistering.
// This should not block process exit. If it does, this test will pass
// but we would fail to exit test run at the end.
// We cannot test this via RemoteInvoke() as that calls Environment.Exit()
// and forces quit even when foreground threads are running.
NetworkChange.NetworkAddressChanged += _addressHandler;
{
};
}

[Fact]
[ActiveIssue(33530, TestPlatforms.FreeBSD)]
public void NetworkAddressChanged_AddAndRemove_NetworkAvailabilityChanged_JustRemove_Success()
Expand Down

0 comments on commit 3154b76

Please sign in to comment.