I am looking for the best pattern to adopt to ensure a method is prevented from running concurrently. An example in objective C would be ideal.
Is it best to use a lock inside the call wrapped around an if statement or an NSOperationQueue and allow only 1 concurrent operation and check the queue for items before adding new ones to the queue. Or should I be looking at something completely different?
The objective is to allow the method to be called on an object and for subsequent calls to be ignored if it is already running.
Aucun commentaire:
Enregistrer un commentaire