On Wed Jun 28 10:13:03 2023 +0000, Rémi Bernon wrote:
What do you think about doing something like https://gitlab.winehq.org/rbernon/wine/-/commit/f264bf99b135f72496f291dcfcff..., to statically assert that the SHM is only written within SHARED_WRITE_BEGIN / SHARED_WRITE_END, and make sure the passed sequence member matches? I'm also considering doing the same on the client side, to better match SERVER_START_REQ / SERVER_END_REQ pattern, and avoid having to pass the sequence member to SHARED_READ_END (and the potential typos), although it's not as interesting there.
Do we really need SHARED_READ_BEGIN / SHARED_READ_END? I think that hiding a loop behind them is not great. It should be possible to achieve that with a helper function, so that client code would look like:
``` unsigned int lock = 0; while (server_shm_lock( &lock, &shared->seq )) { /* read shared */ } ```