So an idea how to make the above check and set atomic, what about using the file_lock primitives to do just this?
Acquire file_lock: - check sempahore owner - clear sempahore (if owner not found) - create semaphore (with self as owner) Release
Now the above is using file locks to do the clearing only. Perhaps this can be a strategy thats provided by default in this new oslo.concurrency library and the library itself takes care of doing this logic described above in a correct manner.
So an idea how to make the above check and set atomic, what about using the file_lock primitives to do just this?
Acquire file_lock:
- check sempahore owner
- clear sempahore (if owner not found)
- create semaphore (with self as owner)
Release
Now the above is using file locks to do the clearing only. Perhaps this can be a strategy thats provided by default in this new oslo.concurrency library and the library itself takes care of doing this logic described above in a correct manner.