That's why I check IsCancellationRequested so that if after 30 seconds, for example, the camera does not connect, it will leave the method and the rest of the requests will be processed. Because when the camera wants to connect, if the method hangs, the rest of the requests will be processed in a longer time. This is where the topic of TimeOut comes in. If each request takes 5 seconds, it takes a total of 50 seconds to complete all requests. If (cts.IsCancellationRequested || camera != default)Īs you can see, I have used both async and Thread, but if, for example, I call this method 10 times at the same time, they will not run simultaneously and in parallel but will run consecutively and one after the other. Thread.Sleep(TimeSpan.FromMilliseconds(10))
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |