Commit 15076cb6 authored by Adam Wujek's avatar Adam Wujek 💬

arch-wrs: improve locking of shmem

Commit based on the commit from wrs-switch-sw described below.

userspace/libwr: improve locking of shmem

Keep explicitly lock bit in the sequence variable as a LSB bit.
This solution is backward compatible. The difference is only when shmem is
lock twice. Before it was treated as unlocked, now still as a lock.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 0f620301
......@@ -32,7 +32,8 @@ struct wrs_shm_head {
int pid; /* The current pid owning the area */
unsigned pidsequence; /* Each new pid must increments this */
unsigned sequence; /* If we need consistency, this is it */
unsigned sequence; /* If we need consistency, this is it. LSB bit
* informs whether shmem is locked already */
unsigned version; /* Version of the data structure */
unsigned data_size; /* Size of it (for binary dumps) */
};
......@@ -42,6 +43,8 @@ struct wrs_shm_head {
#define WRS_SHM_WRITE 0x0001
#define WRS_SHM_LOCKED 0x0002 /* at init time: writers locks, readers wait */
#define WRS_SHM_LOCK_MASK 0x0001
/* Set custom path for shmem */
void wrs_shm_set_path(char *new_path);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment