[Home] [Groups] - Message: [Prev in Group] [Next in Group]
604: Re: [MUD-Dev] Rooms, 3D arrays, etc.
[Full Header] [Plain Text]
From: "Jon A. Lambert" <jlsysinc@ix.netcom.com>
Newsgroups: nu.kanga.list.mud-dev
Date: Fri, 6 Jun 1997 21:12:13 -0400
Organization: Kanga.Nu
> From: clawrenc@cup.hp.com
> at 08:34 PM, "Jon A. Lambert" <jlsysinc@ix.netcom.com> said:
>
> >Does multi-threading have any affects on seeds used in the random
> >generator. Does anyone know if this is truly thread safe?
>
>
> The standard approach is to make private rand() functions for each
> feature. This has the benefit of allowing the choice of algorithm for
> each rand() function to be tailored to the task. The problem is that
> it does not solve the problem if your feature may be called from
> multiple threads (eg multiple threads querying/generating your
> landscape). Next up is to use per-feature specific rand() functions
> and then add some sort of rand() context to each thread (cf rand
> object) which guarantees the sequence.
Yes. This would seem to solve the problem. Generate your own seed table
for use with the terrain generator. If you are generating terrain
as part of bootup or "area" load this may well end up a single-threaded
version of rand(). Other functions whose 'normal' use of rand() wouldn't
need the same attention, except for race conditions.
-
"If I'd known it was harmless, I would have killed it myself"
*- Through a Scanner Darkly - PKD -*
----------