Subject: Re: Thread safety

Re: Thread safety

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Fri, 28 Mar 2008 13:14:11 +0100 (CET)

On Fri, 28 Mar 2008, Eino Tuominen wrote:

> When debugging my application I noticed that c-ares is calling rand(). From
> Solaris 9 man pages:
>
> "The rand() is unsafe in multithreaded applications."

Indeed. Even the Linux man page says: "The function rand() is not reentrant or
thread-safe".

The Linux man page suggests using rand_r() or even better drand48_r() instead.
What's the best alternative on Solaris 9?

-- 
   c-ares -- my preferred DNS asynch resolver library
Received on 2008-03-28