Re: Eaten by the Tiger? Open Source WO is coming...

"Pierce T. Wetter III" <[email protected]> Wed, 31 Aug 2005 09:39:00 -0700
Newsgroups gmane.comp.web.webobjects.general
Message-ID <[email protected]>
On Aug 31, 2005, at 9:19 AM, Helge Hess wrote:

> On 31. Aug 2005, at 17:54 Uhr, Pierce T. Wetter III wrote:
>
>>> As a final note, this code will need to be updated a little bit  
>>> once AJRDatabase supports full multithreading, since the key is  
>>> relying on the behavior of random number generators to produce  
>>> the same series of pseudo random numbers given the same initial  
>>> seed. The problem, of course, is that if another thread calls  
>>> random() between my call to srandom() and random(), we'll be one  
>>> or more values down the sequence and thus won't produce the same  
>>> hash key.
>>>
>>   Have you seen the new @synchronize() keyword in ObjC?
>>
>
> Please don't use that (nor @try) in AJR, it would break with other  
> Foundations and with backwards compatibility in general.

Hmmm... I think the implementation is part of Darwin though (because  
I remember reading the source), and its obviously part of gcc...

  Anyways, if alex is using srandom()/random(), it would be trivial  
to turn the code into a single procedure instead of two successive  
procedure calls. So I wouldn't be using it there, but it would be  
really useful in the rest of AJR.

  What if we used it with a #define, so it could get turned off with  
other foundations (which then might not be as thread safe of course,  
unless they implemented @synchronize, but I think that's pushing the  
problem in the right direction.).

  Pierce