Can SRW Locks be used between processes when placed in shared memory?
Their memory footprint only seems to be a single pointer, but I am unable to find documentation on what actually happens in the background when locking.
I would like to avoid kernel mutexes if possible, but it starts to look like I am entering undefined behaviour land.
SRW Locks cannot be shared between processes. This is implied by pointed omission in the opening sentence of the documentation that says
Slim reader/writer (SRW) locks enable the threads of a single process to access shared resources...
These objects take advantage of the fact that they are used within a single process. For example, the threads waiting to enter the lock are tracked in the form of a linked list. This list of waiting threads obviously has to be kept somewhere outside the SRWLock, seeing as the SRWLock is only the size of a single pointer, and you can't put a list of 10 threads inside a single pointer. That linked list won't accessible to other processes.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With