diff options
author | Alon Levy <alevy@redhat.com> | 2011-09-08 02:16:24 +0300 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2011-10-31 17:35:54 +0200 |
commit | bd8771adbcf3ff34d14333cf874191e8d105f612 (patch) | |
tree | 5c867e871cd4aea5acb4a92aba9883372aa8e7b1 /server/reds.c | |
parent | edb91ccc09e4fd4cad0940d88f3455651eb7c367 (diff) | |
download | spice-bd8771adbcf3ff34d14333cf874191e8d105f612.tar.gz spice-bd8771adbcf3ff34d14333cf874191e8d105f612.tar.xz spice-bd8771adbcf3ff34d14333cf874191e8d105f612.zip |
[0.8 branch] server: add main_dispatcher
add main_dispatcher, a message passing mechanism for sending messages to
the main thread. The main thread is the thread that implements
SpiceCoreInterface, which is assumed to be a single thread.
Similar to the async operation of red_worker, a socket pair is created
and used to pass messages. The messages are a fixed size to ease
parsing. A single message is defined to pass a channel_event.
RHBZ: 746950
FDBZ: 41858
This patch is 0.8 branch only, for the master branch there should be a
better approach to share code with red_dispatcher and ready the way for
later adding more threads.
cherry-pick from 0.8 80caf07e09efe14c67f89a3c01501a6a39681167
Conflicts:
server/reds.c
Diffstat (limited to 'server/reds.c')
-rw-r--r-- | server/reds.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/reds.c b/server/reds.c index 90779ffb..65c98aef 100644 --- a/server/reds.c +++ b/server/reds.c @@ -56,6 +56,7 @@ #include "main_channel.h" #include "red_common.h" #include "red_dispatcher.h" +#include "main_dispatcher.h" #include "snd_worker.h" #include <spice/stats.h> #include "stat.h" @@ -322,7 +323,7 @@ static void reds_stream_channel_event(RedsStream *s, int event) { if (core->base.minor_version < 3 || core->channel_event == NULL) return; - core->channel_event(event, &s->info); + main_dispatcher_channel_event(event, &s->info); } static ssize_t stream_write_cb(RedsStream *s, const void *buf, size_t size) @@ -3519,6 +3520,7 @@ static int do_spice_init(SpiceCoreInterface *core_interface) init_vd_agent_resources(); ring_init(&reds->clients); reds->num_clients = 0; + main_dispatcher_init(core); if (!(reds->mig_timer = core->timer_add(migrate_timout, NULL))) { red_error("migration timer create failed"); |