diff options
author | Frediano Ziglio <fziglio@redhat.com> | 2015-10-13 16:39:46 +0100 |
---|---|---|
committer | Frediano Ziglio <fziglio@redhat.com> | 2015-10-23 12:08:38 +0100 |
commit | a2ebe610c1c9cb72db0364248bb2eba519020fd0 (patch) | |
tree | f2c627ac6114798d7587a342f5af1bb47c118896 /server/red_dispatcher.c | |
parent | 78c8203f16fa6e13198aefb8751c651d58f3f6f9 (diff) | |
download | spice-a2ebe610c1c9cb72db0364248bb2eba519020fd0.tar.gz spice-a2ebe610c1c9cb72db0364248bb2eba519020fd0.tar.xz spice-a2ebe610c1c9cb72db0364248bb2eba519020fd0.zip |
reduce locking time in async_command_alloc
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
Diffstat (limited to 'server/red_dispatcher.c')
-rw-r--r-- | server/red_dispatcher.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c index 4187704b..83aace46 100644 --- a/server/red_dispatcher.c +++ b/server/red_dispatcher.c @@ -335,9 +335,10 @@ static AsyncCommand *async_command_alloc(RedDispatcher *dispatcher, { AsyncCommand *async_command = spice_new0(AsyncCommand, 1); - pthread_mutex_lock(&dispatcher->async_lock); async_command->cookie = cookie; async_command->message = message; + + pthread_mutex_lock(&dispatcher->async_lock); ring_add(&dispatcher->async_commands, &async_command->link); pthread_mutex_unlock(&dispatcher->async_lock); spice_debug("%p", async_command); |