Julian Foad wrote on Mon, 02 Jul 2018 12:20 +0100:
> Philip Martin wrote:
> > I did also worry about thread safety: it's not safe to modify the
> > context like that if the context can be shared across multiple threads.
> > However the context also includes batons and those typically point to
> > mutable data which cannot be shared across threads either. I suppose we
> > should document that a client should only access a context from one
> > thread at a time.
>
> Documenting that sounds reasonable. Like this, just above typedef struct
> svn_client_ctx_t, do you think?
> [[[
> /**
> * Client context
> *
> + * A client should only access a context from one thread at a time, as
> + * the context includes batons that typically point to mutable data which
> + * cannot be safely shared across threads.
> + *
> * @defgroup clnt_ctx Client context management
> *
> * @{
> */
> ]]]
It's not clear to me from the added paragraph whether the restriction
"only access the context from a thread at a time" is imposed by the
library implementation or by the way API consumers' code is typically
structured. That is: if a client is careful to use mutexes in his
batons, or for that matter passes NULL for all batons, would the
restriction still apply?
Cheers,
Daniel
Received on 2018-07-02 21:25:02 CEST