-
Hello, What could be the best approach to store a binary semaphore in a struct inside a mmap file to sync the reads/write from multiple threads? Is it based on a variable? All the examples initialize with new but that would not be possible here.. the semaphore has to lay locally in the allocated space Indirectly, is the semaphore variable guaranteed to always be the same size in the future? For example, in C++20, the binary semaphore is an int. Easy to store. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The Tokio semaphore cannot be shared across processes. It is more complicated than the C++20 binary semaphore because it must work with async/await, requiring a totally different implementation than what is possible for blocking semaphores. There are no guarantees about the semaphore's layout. |
Beta Was this translation helpful? Give feedback.
-
Thanks, not for me then! |
Beta Was this translation helpful? Give feedback.
The Tokio semaphore cannot be shared across processes. It is more complicated than the C++20 binary semaphore because it must work with async/await, requiring a totally different implementation than what is possible for blocking semaphores.
There are no guarantees about the semaphore's layout.