Heroshrine
Heroshrine
CC#
Created by Heroshrine on 9/5/2023 in #help
βœ… Does supplying a task with a delegate / action run that action on the main thread?
thanks for the help. Got it working great πŸ‘ Due to how the game engine unity work I'm still essentially checking a variable in an update loop, but that is now a bool instead of a reference to a task, and it seems to be faster as well.
19 replies
CC#
Created by Heroshrine on 9/5/2023 in #help
βœ… Does supplying a task with a delegate / action run that action on the main thread?
I know about async/await. I don’t know how i would use it. Would I call an async method like a normal method, and have that await the task?
19 replies
CC#
Created by Heroshrine on 9/5/2023 in #help
βœ… Does supplying a task with a delegate / action run that action on the main thread?
basically I have some work I'm doing by using Task.Run(). Right now I'm just checking in a loop to see when it's finished, but I would like to know if there is a more elegant or better way to get notified when the work is finished. I'm returning a Stack from the Task. Right now I'm saving a reference to the Task and in a loop checking if it is complete. if it is, grab the stack from the result of the task.
19 replies
CC#
Created by Heroshrine on 9/5/2023 in #help
βœ… Does supplying a task with a delegate / action run that action on the main thread?
ah, I had no idea. Yes I'm using Task.Run() which I know is shorthand for using the task factory. I'm only just starting to use Tasks and dip into multithreading. I mostly use unity so my c# experience isn't "classic" experience, but they told me to go here because this question isn't about unity.
19 replies