[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 06/11] qobject: add QBool type
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH 06/11] qobject: add QBool type |
Date: |
Mon, 19 Oct 2009 12:21:14 -0200 |
On Mon, 19 Oct 2009 09:17:38 -0500
Anthony Liguori <address@hidden> wrote:
> Luiz Capitulino wrote:
> > On Sat, 17 Oct 2009 08:36:06 -0500
> > Anthony Liguori <address@hidden> wrote:
> >
> >
> >> We currently model as json bool as an int. This works fine on the server
> >> side
> >> but it means we cannot send back proper bools to the client. Introducing a
> >> proper QBool type fixes that.
> >>
> >
> > As we talked earlier today, I think it would be simpler to have QTrue,
> > QFalse and QNull as static objects.
> >
> > We could define that static objects get reference counting disabled, I
> > don't
> > see issues in doing that and we get a very simple model.
> >
> > The big patch bellow does it, only compiled tested though.
> >
> > If you don't agree with this model, we'll have to allocate QNull objects.
> > Actually I would suggest a destroy() method which always resets the
> > refcount to 1, but then it will have the concurrency problems on threaded
> > applications you've mentioned.
> >
>
> A lot of object systems have dealt with this in various ways. The
> trouble with reference counting is usually thread safety. CLR goes to
> great lengths to make their objects reference counting thread safe and
> it comes at a cost. Python doesn't do anything explicit and it's one of
> the reasons that they're stuck with a big lock.
>
> Since I'd like to expose QObject to client libraries, having a single
> static instance would be pretty unfortunate as it would imply a weird
> locking semantics. Disabling reference counts for QNull/QBool seems
> unfortunate because it suggests that different semantics for certain
> objects.
>
> I think this is a premature optimization. I don't think we need to try
> and save the memory here.
You can add QNull in your series then.
- [Qemu-devel] [PATCH 03/11] Add a test case for qfloat, (continued)
- [Qemu-devel] [PATCH 03/11] Add a test case for qfloat, Anthony Liguori, 2009/10/17
- [Qemu-devel] [PATCH 04/11] Add json->qobject parser, Anthony Liguori, 2009/10/17
- [Qemu-devel] [PATCH 07/11] qjson: Use QBool for true/false keywords, Anthony Liguori, 2009/10/17
- [Qemu-devel] [PATCH 08/11] qjson: add %i for parsing bools, Anthony Liguori, 2009/10/17
- [Qemu-devel] [PATCH 06/11] qobject: add QBool type, Anthony Liguori, 2009/10/17
- [Qemu-devel] [PATCH 05/11] Add unit test for json parser, Anthony Liguori, 2009/10/17
- [Qemu-devel] [PATCH 09/11] qjson: add unit test for varargs bool parsing, Anthony Liguori, 2009/10/17
- [Qemu-devel] [PATCH 10/11] qjson: add vararg format for embedded qobjects, Anthony Liguori, 2009/10/17
- [Qemu-devel] [PATCH 11/11] qjson: add unit test to check %p format, Anthony Liguori, 2009/10/17
- Re: [Qemu-devel] [PATCH 0/11] json parser (v2), Luiz Capitulino, 2009/10/18