apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aaron Bannert <aa...@clove.org>
Subject Re: race condition in apr_uuid_get
Date Thu, 29 Nov 2001 00:29:58 GMT
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?

-aaron

Mime
View raw message