From: Rémi Bernon rbernon@codeweavers.com
Based on a patch by Huw Davies huw@codeweavers.com. --- server/protocol.def | 1 + server/queue.c | 5 +++++ 2 files changed, 6 insertions(+)
diff --git a/server/protocol.def b/server/protocol.def index 84157dc2b05..5d7b843d592 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -891,6 +891,7 @@ struct shared_cursor
typedef volatile struct { + LONG64 seq; /* sequence number - server updating if (seq & 1) != 0 */ struct shared_cursor cursor; /* global cursor information */ } desktop_shm_t;
diff --git a/server/queue.c b/server/queue.c index 7d9d6ac9ee6..c19cf5c3806 100644 --- a/server/queue.c +++ b/server/queue.c @@ -237,10 +237,15 @@ static unsigned int cursor_history_latest; do { \ const type *__shared = (object)->shared; \ type *shared = (type *)__shared; \ + LONG64 __seq = shared->seq + 1, __end = __seq + 1; \ + assert( (__seq & 1) != 0 ); \ + __WINE_ATOMIC_STORE_RELEASE( &shared->seq, &__seq ); \ do
#define SHARED_WRITE_END \ while(0); \ + assert( __seq == shared->seq ); \ + __WINE_ATOMIC_STORE_RELEASE( &shared->seq, &__end ); \ } while(0)
static void queue_hardware_message( struct desktop *desktop, struct message *msg, int always_queue );