I have a minutely scheduled task and I only want to be accessed 1 thread at a time, I use SemaphoreSlim as C# code below, but the other thread can enter before the previous thread has been completely finished.. what I missed?
public static async Task<bool> Update_ThumbnailsAsync(long _survey_pid, bool _thumbnails)
{
using (var _sem = new SemaphoreSlim(1, 1))
{
await _sem.WaitAsync();
... doing loop process here
...
...
...
}
}