Module: wine Branch: master Commit: fd3de9005ef504a810aeb828c5b491a7bebd7888 URL: https://gitlab.winehq.org/wine/wine/-/commit/fd3de9005ef504a810aeb828c5b491a...
Author: Rémi Bernon rbernon@codeweavers.com Date: Mon Feb 19 22:37:36 2024 +0100
server: Create a thread message queue shared mapping.
---
include/wine/server_protocol.h | 8 +++++++- server/protocol.def | 6 ++++++ server/queue.c | 8 ++++++++ 3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index f5b1e9f8475..b8a4878c7d5 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -897,9 +897,15 @@ typedef volatile struct unsigned char keystate[256]; } desktop_shm_t;
+typedef volatile struct +{ + int placeholder; +} queue_shm_t; + typedef volatile union { desktop_shm_t desktop; + queue_shm_t queue; } object_shm_t;
typedef volatile struct @@ -6569,7 +6575,7 @@ union generic_reply
/* ### protocol_version begin ### */
-#define SERVER_PROTOCOL_VERSION 815 +#define SERVER_PROTOCOL_VERSION 816
/* ### protocol_version end ### */
diff --git a/server/protocol.def b/server/protocol.def index 11539654dc3..97b4805c552 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -913,9 +913,15 @@ typedef volatile struct unsigned char keystate[256]; /* asynchronous key state */ } desktop_shm_t;
+typedef volatile struct +{ + int placeholder; +} queue_shm_t; + typedef volatile union { desktop_shm_t desktop; + queue_shm_t queue; } object_shm_t;
typedef volatile struct diff --git a/server/queue.c b/server/queue.c index a7814c83737..5f4e5fa33c2 100644 --- a/server/queue.c +++ b/server/queue.c @@ -146,6 +146,7 @@ struct msg_queue struct hook_table *hooks; /* hook table */ timeout_t last_get_msg; /* time of last get message call */ int keystate_lock; /* owns an input keystate lock */ + const queue_shm_t *shared; /* queue in session shared memory */ };
struct hotkey @@ -321,6 +322,12 @@ static struct msg_queue *create_msg_queue( struct thread *thread, struct thread_ list_init( &queue->expired_timers ); for (i = 0; i < NB_MSG_KINDS; i++) list_init( &queue->msg_list[i] );
+ if (!(queue->shared = alloc_shared_object())) + { + release_object( queue ); + return NULL; + } + thread->queue = queue; } if (new_input) release_object( new_input ); @@ -1210,6 +1217,7 @@ static void msg_queue_destroy( struct object *obj ) release_object( queue->input ); if (queue->hooks) release_object( queue->hooks ); if (queue->fd) release_object( queue->fd ); + if (queue->shared) free_shared_object( queue->shared ); }
static void msg_queue_poll_event( struct fd *fd, int event )