Filter Lock algorithm, algorithm based on Test and Set instruction