[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC v5 15/26] monitor: let suspend_cnt be thread safe
From: |
Stefan Hajnoczi |
Subject: |
Re: [Qemu-devel] [RFC v5 15/26] monitor: let suspend_cnt be thread safe |
Date: |
Sat, 16 Dec 2017 09:11:08 +0000 |
User-agent: |
Mutt/1.9.1 (2017-09-22) |
On Sat, Dec 16, 2017 at 02:12:11PM +0800, Peter Xu wrote:
> On Wed, Dec 13, 2017 at 06:43:58PM +0000, Stefan Hajnoczi wrote:
> > On Tue, Dec 05, 2017 at 01:51:49PM +0800, Peter Xu wrote:
> > > Monitor code now can be run in more than one thread. Let it be thread
> > > safe when accessing suspend_cnt counter.
> >
> > Please add doc comments to the functions explaining which thread they
> > may be called from (especially public functions). Without this
> > information other people will have a hard time keeping code thread-safe.
>
> The two public functions would be monitor_resume() and
> monitor_suspend(). IIUC as long as these functions are using atomic
> operations correctly they should be able to be called anywhere?
>
> Could you help point out what I missed?
I don't mean just the public functions. How are other people supposed
to know which monitor function executes in which thread without first
studying all the monitor code? This is where comments, naming schemes,
or grouping functions helps.
Not every function needs to be documented in detail, but there needs to
be some structure to help people understand what happens in the IOThread
and what happens in the main loop.
Just adding threading to the existing code without leaving clues for
people who come after you is likely to result in future bugs.
Stefan
signature.asc
Description: PGP signature
- Re: [Qemu-devel] [RFC v5 13/26] qmp: introduce some capability helpers, (continued)
[Qemu-devel] [RFC v5 16/26] monitor: separate QMP parser and dispatcher, Peter Xu, 2017/12/05
- Re: [Qemu-devel] [RFC v5 16/26] monitor: separate QMP parser and dispatcher, Stefan Hajnoczi, 2017/12/13
- Re: [Qemu-devel] [RFC v5 16/26] monitor: separate QMP parser and dispatcher, Peter Xu, 2017/12/16
- Re: [Qemu-devel] [RFC v5 16/26] monitor: separate QMP parser and dispatcher, Peter Xu, 2017/12/16
- Re: [Qemu-devel] [RFC v5 16/26] monitor: separate QMP parser and dispatcher, Stefan Hajnoczi, 2017/12/16
- Re: [Qemu-devel] [RFC v5 16/26] monitor: separate QMP parser and dispatcher, Peter Xu, 2017/12/18
- Re: [Qemu-devel] [RFC v5 16/26] monitor: separate QMP parser and dispatcher, Stefan Hajnoczi, 2017/12/18
- Re: [Qemu-devel] [RFC v5 16/26] monitor: separate QMP parser and dispatcher, Peter Xu, 2017/12/18
[Qemu-devel] [RFC v5 17/26] qmp: add new event "request-dropped", Peter Xu, 2017/12/05