I have a problem where I have a kind of shared/exclusive situation except that what the shared part needn't really be shared: I'll try to explain.
The exclusive part is easy: if the exclusive lock is held, noone else is allowed to progress until the owner of the exclusive lock releases it.
The (not really) shared workers should operate like this:
- if the exclusive lock is held, or no lock: (wait for exclusive to be released, and) do "shared" work.
- if the "shared" lock is already held or this is the second / nth "shared worker" to wait for the exclusive lock: wait for the shared lock (of the first "shared worker") to be released, but then don't do the work, but just return, because the first "shared worker" already just did the job.
Is there a name for this lock/work pattern? If there isn't a name per se, I'm interested whether this is is used at all / what I wrote makes sense.