Thread (6 messages) 6 messages, 3 authors, 2022-05-26

Re: [PATCH] http.c: clear the 'finished' member once we are done with it

From: Johannes Schindelin <hidden>
Date: 2022-05-24 11:04:06

Hi Junio,

On Mon, 23 May 2022, Junio C Hamano wrote:
Johannes Schindelin [off-list ref] writes:
quoted
I suggested to replace the `finished` variable with an attribute (or
"field" or "member variable") of the slot, and to respect it when
looking for an unused slot, i.e. not only look for a slot whose
`in_use` is 0 but also require `reserved_for_use` to be 0. In essence,
the `run_active_slot()` function owns the slot, even if it is not
marked as `in_use`. That should address the same concern as baa7b67d
but without using a pointer to a local variable.
Not really.  An outer run_active_slot() and an inner
run_active_slot() have a pointer to the same slot object.
How is that possible? One of the first things that function does is to
assign `slot->finished = &finished`, and then run that `while (!finished)`
loop.

How would the outer `run_active_slot()` ever get signaled via `finished`
when the inner `run_active_slot()` would overwrite `slot->finished`? I am
puzzled why we do not see infinite loops in such outer calls all the time,
then.

Ciao,
Dscho
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help