Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

coroutine: switch to QSLIST

QSLIST can be used for a free list, do it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
  • Loading branch information...
commit 1bbbdabd568fb62125cf214327b4fb5c5d49c694 1 parent cf904cf
Paolo Bonzini authored Anthony Liguori committed
10  coroutine-ucontext.c
@@ -36,7 +36,7 @@ enum {
36 36
 };
37 37
 
38 38
 /** Free list to speed up creation */
39  
-static QLIST_HEAD(, Coroutine) pool = QLIST_HEAD_INITIALIZER(pool);
  39
+static QSLIST_HEAD(, Coroutine) pool = QSLIST_HEAD_INITIALIZER(pool);
40 40
 static unsigned int pool_size;
41 41
 
42 42
 typedef struct {
@@ -92,7 +92,7 @@ static void __attribute__((destructor)) coroutine_cleanup(void)
92 92
     Coroutine *co;
93 93
     Coroutine *tmp;
94 94
 
95  
-    QLIST_FOREACH_SAFE(co, &pool, pool_next, tmp) {
  95
+    QSLIST_FOREACH_SAFE(co, &pool, pool_next, tmp) {
96 96
         g_free(DO_UPCAST(CoroutineUContext, base, co)->stack);
97 97
         g_free(co);
98 98
     }
@@ -175,9 +175,9 @@ Coroutine *qemu_coroutine_new(void)
175 175
 {
176 176
     Coroutine *co;
177 177
 
178  
-    co = QLIST_FIRST(&pool);
  178
+    co = QSLIST_FIRST(&pool);
179 179
     if (co) {
180  
-        QLIST_REMOVE(co, pool_next);
  180
+        QSLIST_REMOVE_HEAD(&pool, pool_next);
181 181
         pool_size--;
182 182
     } else {
183 183
         co = coroutine_new();
@@ -190,7 +190,7 @@ void qemu_coroutine_delete(Coroutine *co_)
190 190
     CoroutineUContext *co = DO_UPCAST(CoroutineUContext, base, co_);
191 191
 
192 192
     if (pool_size < POOL_MAX_SIZE) {
193  
-        QLIST_INSERT_HEAD(&pool, &co->base, pool_next);
  193
+        QSLIST_INSERT_HEAD(&pool, &co->base, pool_next);
194 194
         co->base.caller = NULL;
195 195
         pool_size++;
196 196
         return;
2  qemu-coroutine-int.h
@@ -37,7 +37,7 @@ struct Coroutine {
37 37
     CoroutineEntry *entry;
38 38
     void *entry_arg;
39 39
     Coroutine *caller;
40  
-    QLIST_ENTRY(Coroutine) pool_next;
  40
+    QSLIST_ENTRY(Coroutine) pool_next;
41 41
     QTAILQ_ENTRY(Coroutine) co_queue_next;
42 42
 };
43 43
 

0 notes on commit 1bbbdab

Please sign in to comment.
Something went wrong with that request. Please try again.