[Insight-developers] Patch for gdcm::Util::CreateUniqueUID

Mathieu Malaterre mathieu.malaterre at gmail.com
Wed Apr 23 18:34:29 EDT 2008


Hi Henning,

  Thanks a bunch for your patch, it is very well written. You are
using the WIN32 api but hopefully it should be fairly easy to port to
POSIX system. I really like your implementation using the threadid
instead of a random number. I believe I now understand why you could
get duplicate keys: start two thread and start two gdcm, with a little
of bad luck the c-function rand() will return *exactly* the same
number. So on the same physical machine at the same millisecond, the
two keys would be the same :( Same goes for processid.
  So yes it will definitely goes into gdcm CVS, just give me some time
to fix the 'long long' issue  (this is not portable) and the
WIN32-specific function which I need to find POSIX equivalents for.

Thanks again !
-Mathieu

On Mon, Apr 21, 2008 at 3:08 PM, Henning Meyer <tutmann at gmail.com> wrote:
> Hello All,
>
>  I wrote a small Patch for gdcm::Util::CreateUniqueUID, because with my
>  setup I had UID-Clashes under Windows from time to time.
>  I think its a good idea to use a Counter instead of a two-digit random
>  number and also to include thread-id or process-id.
>  I hope I won't offend you to much by not using the version control,
>  but this seemed easiest.
>  I hope you like it and include it to the repository.
>
>  Thank you,
>
>  Henning
>
> _______________________________________________
>  Insight-developers mailing list
>  Insight-developers at itk.org
>  http://www.itk.org/mailman/listinfo/insight-developers
>
>



-- 
Mathieu


More information about the Insight-developers mailing list