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
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
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
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*.