diff options
author | Sangho Park <sangho1206.park@samsung.com> | 2014-05-20 02:07:20 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@review.vlan103.tizen.org> | 2014-05-20 02:07:20 -0700 |
commit | eb2a22ef2578540a7731a4b2936323371ccf71cd (patch) | |
tree | 615d25fc07b46bcd6586425b14b525667579fd17 /tizen | |
parent | d24b8f5f0e0a5d7ff4b5ed3fe67627ea387df98b (diff) | |
parent | ffc48957281dfa18b3fbab3c0e8510d4cf5c6d0a (diff) | |
download | qemu-eb2a22ef2578540a7731a4b2936323371ccf71cd.tar.gz qemu-eb2a22ef2578540a7731a4b2936323371ccf71cd.tar.bz2 qemu-eb2a22ef2578540a7731a4b2936323371ccf71cd.zip |
Merge "guest_server: make client list thread-safe use QTAIL_FOREACH_SAFE instead of QTAIL_FOREACH" into tizen
Diffstat (limited to 'tizen')
-rw-r--r-- | tizen/src/guest_server.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/tizen/src/guest_server.c b/tizen/src/guest_server.c index bd7e97b4f5..e6a91eb9b4 100644 --- a/tizen/src/guest_server.c +++ b/tizen/src/guest_server.c @@ -140,9 +140,9 @@ static void send_to_sdb_client(GS_Client* client, int state) void notify_all_sdb_clients(int state) { pthread_mutex_lock(&mutex_clilist); - GS_Client *client; + GS_Client *client, *next; - QTAILQ_FOREACH(client, &clients, next) + QTAILQ_FOREACH_SAFE(client, &clients, next, next) { send_to_sdb_client(client, state); } @@ -153,7 +153,7 @@ void notify_all_sdb_clients(int state) static void add_sdb_client(struct sockaddr_in* addr, int port, const char* serial) { GS_Client *cli = NULL; - GS_Client *client = NULL; + GS_Client *client = NULL, *next; if (addr == NULL) { INFO("GS_Client client's address is EMPTY.\n"); @@ -166,7 +166,7 @@ static void add_sdb_client(struct sockaddr_in* addr, int port, const char* seria return; } - QTAILQ_FOREACH(cli, &clients, next) + QTAILQ_FOREACH_SAFE(cli, &clients, next, next) { if (!strcmp(serial, cli->serial) && !strcmp(inet_ntoa(addr->sin_addr), inet_ntoa((cli->addr).sin_addr))) { INFO("Client cannot be duplicated.\n"); @@ -546,9 +546,9 @@ static void server_process(void) static void close_clients(void) { pthread_mutex_lock(&mutex_clilist); - GS_Client * client; + GS_Client * client, *next; - QTAILQ_FOREACH(client, &clients, next) + QTAILQ_FOREACH_SAFE(client, &clients, next, next) { QTAILQ_REMOVE(&clients, client, next); |