I have a button that has a handler asyncthat causes a wait on an asynchronous method. Here's what it looks like:
private async void Button1_OnClick(object sender, RoutedEventArgs e)
{
await IpChangedReactor.UpdateIps();
}
Here's what it looks like IpChangedReactor.UpdateIps():
public async Task UpdateIps()
{
await UpdateCurrentIp();
await UpdateUserIps();
}
It is asynchronous. Now I have DispatcherTimerone that re-calls await IpChangedReactor.UpdateIpsin its tick.
Say I pressed a button. Now the event handler waits UpdateIpsand returns to the caller, which means that WPF will continue to do other things. In the meantime, if the timer fires, it will call again UpdateIps, and now both methods will execute simultaneously. So I see that it is like using 2 threads. Are race conditions possible? (Part of me says no, because everything works on the same thread, but it is confusing)
, async . .
, , . .
- ?