Edit: As per suggestions in the comments, I will list out the actual functions of both A and B and what I am trying to achieve.
I am trying to create a loading animation in a C# Console Application. Function A repeatedly (hence why while true) draws characters on the screen (the animation), whilst Function B executes some code in the background.
As such, I need function A to stop once function B is completed, since that is when the program is "loaded".
I have two functions.
public static void A(){
while(true){//repeatedly do one thing}
}
public static void B(){
//do something
//do something
//do something
}
static void Main(string[] args) {//main func}
Basically, I want to execute A (since it is a while loop) as long as B is running. Once B has finished executing its code, A will stop executing.
I have tried Parallel.Invoke but the problem with that is Parallel.Invoke waits for will wait for both functions to finish executing before it stops. Since function A is a never ending loop, Parallel.Invoke will never end as well.
Any suggestions is thanked in advance.