Re: [RFC PATCH v2 03/14] job.h: define locked functions

2021-12-20 Thread Emanuele Giuseppe Esposito
On 16/12/2021 18:11, Vladimir Sementsov-Ogievskiy wrote: 16.12.2021 19:48, Stefan Hajnoczi wrote: On Thu, Nov 04, 2021 at 10:53:23AM -0400, Emanuele Giuseppe Esposito wrote:   /** Returns whether the job is ready to be completed. */   bool job_is_ready(Job *job); +/** Same as

Re: [RFC PATCH v2 03/14] job.h: define locked functions

2021-12-16 Thread Vladimir Sementsov-Ogievskiy
16.12.2021 19:48, Stefan Hajnoczi wrote: On Thu, Nov 04, 2021 at 10:53:23AM -0400, Emanuele Giuseppe Esposito wrote: /** Returns whether the job is ready to be completed. */ bool job_is_ready(Job *job); +/** Same as job_is_ready(), but assumes job_lock is held. */ +bool

Re: [RFC PATCH v2 03/14] job.h: define locked functions

2021-12-16 Thread Stefan Hajnoczi
On Thu, Nov 04, 2021 at 10:53:23AM -0400, Emanuele Giuseppe Esposito wrote: > /** Returns whether the job is ready to be completed. */ > bool job_is_ready(Job *job); > > +/** Same as job_is_ready(), but assumes job_lock is held. */ > +bool job_is_ready_locked(Job *job); What I see here is

[RFC PATCH v2 03/14] job.h: define locked functions

2021-11-04 Thread Emanuele Giuseppe Esposito
These functions assume that the job lock is held by the caller, to avoid TOC/TOU conditions. Introduce also additional helpers that define _locked functions (useful when the job_mutex is globally applied). Note: at this stage, job_{lock/unlock} and job lock guard macros are *nop*.