[Spice-devel] [server PATCH 8/8] red_channel: replace RING_FOREACH with RING_FOREACH_SAFE in some places
Uri Lublin
uril at redhat.com
Mon Jul 8 03:32:30 PDT 2013
This was originally intended to fix the problem fixed by
commit 53488f0275d6c8a121af49f7ac817d09ce68090d.
What is left are FOREACH loops that are at less risk and maybe safe (no
read/write or disconnect/destroy are called from within them).
---
server/red_channel.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/server/red_channel.c b/server/red_channel.c
index 8742008..85d7ebc 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -2025,7 +2025,7 @@ void red_client_set_main(RedClient *client, MainChannelClient *mcc) {
void red_client_semi_seamless_migrate_complete(RedClient *client)
{
- RingItem *link;
+ RingItem *link, *next;
pthread_mutex_lock(&client->lock);
if (!client->during_target_migrate || client->seamless_migrate) {
@@ -2034,7 +2034,7 @@ void red_client_semi_seamless_migrate_complete(RedClient *client)
return;
}
client->during_target_migrate = FALSE;
- RING_FOREACH(link, &client->channels) {
+ RING_FOREACH_SAFE(link, next, &client->channels) {
RedChannelClient *rcc = SPICE_CONTAINEROF(link, RedChannelClient, client_link);
if (rcc->latency_monitor.timer) {
@@ -2073,12 +2073,12 @@ static void red_channel_pipes_create_batch(RedChannel *channel,
new_pipe_item_t creator, void *data,
rcc_item_t callback)
{
- RingItem *link;
+ RingItem *link, *next;
RedChannelClient *rcc;
PipeItem *item;
int num = 0;
- RING_FOREACH(link, &channel->clients) {
+ RING_FOREACH_SAFE(link, next, &channel->clients) {
rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link);
item = (*creator)(rcc, data, num++);
if (callback) {
--
1.7.1
More information about the Spice-devel
mailing list