summaryrefslogtreecommitdiffstats
path: root/server/red_channel.h
diff options
context:
space:
mode:
authorYonit Halperin <yhalperi@redhat.com>2013-07-26 13:45:16 -0400
committerYonit Halperin <yhalperi@redhat.com>2013-07-29 11:35:16 -0400
commitaab45618cc12799d5f7351ef8832ae73b33057c7 (patch)
treed790a3bcc20c8b69f0224e0f20e869094bc1fbb2 /server/red_channel.h
parent47e722b85ccd0b6876ca189a3d6f6f05289fe3c3 (diff)
downloadspice-aab45618cc12799d5f7351ef8832ae73b33057c7.tar.gz
spice-aab45618cc12799d5f7351ef8832ae73b33057c7.tar.xz
spice-aab45618cc12799d5f7351ef8832ae73b33057c7.zip
red_channel: add ref count to RedClient
Diffstat (limited to 'server/red_channel.h')
-rw-r--r--server/red_channel.h17
1 files changed, 15 insertions, 2 deletions
diff --git a/server/red_channel.h b/server/red_channel.h
index ba299b66..0dd73ea8 100644
--- a/server/red_channel.h
+++ b/server/red_channel.h
@@ -561,10 +561,25 @@ struct RedClient {
is called */
int seamless_migrate;
int num_migrated_channels; /* for seamless - number of channels that wait for migrate data*/
+ int refs;
};
RedClient *red_client_new(int migrated);
+/*
+ * disconnects all the client's channels (should be called from the client's thread)
+ */
+void red_client_destroy(RedClient *client);
+
+RedClient *red_client_ref(RedClient *client);
+
+/*
+ * releases the client resources when refs == 0.
+ * We assume the red_client_derstroy was called before
+ * we reached refs==0
+ */
+RedClient *red_client_unref(RedClient *client);
+
MainChannelClient *red_client_get_main(RedClient *client);
// main should be set once before all the other channels are created
void red_client_set_main(RedClient *client, MainChannelClient *mcc);
@@ -580,7 +595,5 @@ void red_client_semi_seamless_migrate_complete(RedClient *client); /* dst side *
int red_client_during_migrate_at_target(RedClient *client);
void red_client_migrate(RedClient *client);
-// disconnects all the client's channels (should be called from the client's thread)
-void red_client_destroy(RedClient *client);
#endif