I have a method which I only want a thread to run one at a time.
The problem is, the execution of this method is coupled with a Command, so when a user presses a button a few times in a row really fast, my method gets called a few times in a row by the same thread. Locking doesn't work in this case since the same thread just gets the lock time and time again. I find it odd that the same method is called a few times in a row by the same thread while earlier calls of the method haven't finished yet.
Is there any way to force a method to run only one at a time from a single thread?