apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Bloom <...@covalent.net>
Subject Re: race condition in apr_uuid_get
Date Thu, 29 Nov 2001 00:38:56 GMT
On Wednesday 28 November 2001 04:29 pm, Aaron Bannert wrote:
> On Wed, Nov 28, 2001 at 04:21:21PM -0800, Doug MacEachern wrote:
> > i seem to recall mention of apr_uuid having thread issues, but couldn't
> > find anything in the STATUS file or archives.  anyhoo, any thoughts on
> > solving the race condition here:
> >
> > srclib/apr/misc/unix/getuuid.c:
> >
> > static int uuid_state_seqnum;
> > static unsigned char uuid_state_node[NODE_LENGTH] = { 0 };
> > ...
> > static void init_state(void)
> > {
> >     uuid_state_seqnum = true_random();
> >     get_pseudo_node_identifier(uuid_state_node);
> > }
> >
> > APR_DECLARE(void) apr_uuid_get(apr_uuid_t *uuid)
> > {
> >     ...
> >     if (!uuid_state_node[0])
> >         init_state();
>
> Would apr_thread_once help here, in addition to the normal mutex routines?

If you use apr_thread_once, you shouldn't need any mutexes, and yeah,
it should solve this bug.

Ryan

______________________________________________________________
Ryan Bloom				rbb@apache.org
Covalent Technologies			rbb@covalent.net
--------------------------------------------------------------

Mime
View raw message