Re: [squid-users] Question on storeAufsClose

From: Robert Collins <robert.collins@dont-contact.us>
Date: 02 Sep 2001 18:41:35 +1000

On 01 Sep 2001 17:59:55 -0400, Brian wrote:
> I notice that storeAufsClose does this:
> if (storeAufsSomethingPending(sio)) {
> aiostate->flags.close_request = 1;
> return;
> }
>
> and storeAufsReadDone does this:
> aiostate->flags.inreaddone = 0;
> if (aiostate->flags.close_request)
> storeAufsIOCallback(sio, errflag);
>
> So my question is...
> Can these two run close enough together that storeAufsSomethingPending
> returns true, but storeAufsClose doesn't set the flag in time to catch
> storeAufsReadDone?

As in "is there a potential race between storeAufsClose and
storeAufsReadDone on the same sio structure?"

No.

storeAufsClose is called from a single thread - squids main thread.
storeAufsReadDone is a callback for the actual async io functions, and
is also called from the same thread.

For a race, we would need the squid main thread to context switch after
storeAufsSomethingPending(sio), but before setting the flag, and before
squid had another timeslice, for a different thread to call into
storeAufsReadDone.

As the same thread calls both functions, that cannot happen.

Why do you ask?

Rob
Received on Sun Sep 02 2001 - 02:41:01 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:02:01 MST