Lock into async Method into my Xamarin app

Viewed 154

i need to lock a method preventing multiple simultaneous execution, this is my solutions, is it thread safe? is it safe?

    public async Task ExecuteApiCalls()
    {
        lock (lockObject)
        {
             var t = Task.Run(async () => {
                //my async code  
             }  
             Task.WaitAny(t);
        });

        
        
    }
0 Answers
Related