diff options
| author | Anthony Liguori <aliguori@us.ibm.com> | 2011-09-08 09:05:14 -0500 |
|---|---|---|
| committer | Anthony Liguori <aliguori@us.ibm.com> | 2011-09-08 09:05:14 -0500 |
| commit | 220724ca4ada4e30bcfff326b62822a69c23e181 (patch) | |
| tree | c0bb1bdd3ec41c5945000cf43620725d2e00ffd8 /async.c | |
| parent | d8ac46d950451a722fd6b1d5d0768c72bee87d47 (diff) | |
| parent | cfc606da0ddcef1f7228317b9f7dfa6c94c6c64f (diff) | |
| download | focaccia-qemu-220724ca4ada4e30bcfff326b62822a69c23e181.tar.gz focaccia-qemu-220724ca4ada4e30bcfff326b62822a69c23e181.zip | |
Merge remote-tracking branch 'kwolf/for-anthony' into staging
Diffstat (limited to 'async.c')
| -rw-r--r-- | async.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/async.c b/async.c index 9d4e960b02..ca13962222 100644 --- a/async.c +++ b/async.c @@ -55,6 +55,9 @@ int qemu_bh_poll(void) { QEMUBH *bh, **bhp, *next; int ret; + static int nesting = 0; + + nesting++; ret = 0; for (bh = first_bh; bh; bh = next) { @@ -68,15 +71,20 @@ int qemu_bh_poll(void) } } + nesting--; + /* remove deleted bhs */ - bhp = &first_bh; - while (*bhp) { - bh = *bhp; - if (bh->deleted) { - *bhp = bh->next; - g_free(bh); - } else - bhp = &bh->next; + if (!nesting) { + bhp = &first_bh; + while (*bhp) { + bh = *bhp; + if (bh->deleted) { + *bhp = bh->next; + g_free(bh); + } else { + bhp = &bh->next; + } + } } return ret; |