Re: homed: Purpose of assert(!h->current_operation)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On So, 26.06.22 02:57, Léo (leeo97one@xxxxxxxxx) wrote:

> Hello,
>
> I would like to know the purpose of this assert operation:
> https://github.com/systemd/systemd/blob/v251/src/home/homed-home.c#L2697
>
> What does it mean if it fails?

It just encodes that this function expects to be called with no
operation currently being executed.

Like all assert() it just encodes assumptions made by the programmer,
i.e. stuff that should be guranteed at this point, and if not met
indicate a programming error (as opposed to a runtime error).

Specifically, for each home dir, we allow exactly one operation to be
executed at once, and all other ones are queued. Thus, when we start
to execute one operation we check that there is none already being
executed, because if it was, then there's a bug somewhere.

Why do you ask? did you actually see the assertion being hit?

Lennart

--
Lennart Poettering, Berlin



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux