Semaphore using 2 keys and 3 keys

In reply to dave_59:

In reply to Shruti Kamble:
No. get() and put() are atomic test and set operations. The results from any other method could be invalid as soon as they are returned.

Thank you dave … :)