I have one async task executing an infinite loop doing real-time processing:
private async void RealTimeProcessingAsync()
{
while (true)
{
Tmstaus status = await ReadStatusAsync();
switch (status)
{
case Ack:
break;
}
}
}
And I created another async method SendWriteRqst, which sends the command to RealTimeProcessingAsync (), must wait until the status is set to a specific condition and returns.
public async Task<WriteState> SendWriteRqstAsync(TmCommand tmCmd)
{
await SomeCondition()
return wrState;
}
It will work if SomeCondition () starts another while loop in the polling state and returns true if the conditions are set, but I'm looking for a better solution.
(Sorry for the bad English)
source
share