Looks like the rand_s was done for "thread safe" use as there's an older 
version in normrnd.c that uses rand().  But rand_s() is not any more threadsafe 
than rand() for Windows.  rand_s is "secure".
rand() is thread safe in the VC runtime since static variables are placed on 
TLS.

http://stackoverflow.com/questions/143108/is-windows-rand-s-thread-safe#143119

So....this patch just changes windows to use rand() again.
Index: 
normrnd.c===================================================================--- 
normrnd.c   (revision 7303)+++ normrnd.c   (working copy)@@ -29,7 +29,9 @@ #if 
_WIN32 // note the underscore: without it, it's not msdn official!        // 
Windows (x64 and x86)        #include <windows.h>   // required only for 
GetTickCount(...)-       #define K_RAND_MAX UINT_MAX+       #define K_RAND_MAX 
RAND_MAX+       #define rand_s(x) (*x)=rand()   // returns unsigned integers in 
the range 0..0x7FFFFFFF
 #elif _SVID_SOURCE || _XOPEN_SOURCE || __unix__ || (defined (__APPLE__) && 
defined(__MACH__)) /* POSIX or Unix or Apple */        #include <stdlib.h>      
  #define rand_s(x) (*x)=(unsigned int)lrand48()  // returns unsigned integers 
in the range 0..0x7FFFFFFF
de Mike W9MDB



      From: Bill Somerville <g4...@classdesign.com>
 To: wsjt-devel@lists.sourceforge.net 
 Sent: Friday, November 11, 2016 8:51 AM
 Subject: Re: [wsjt-devel] r7303 error?
   
 On 11/11/2016 14:37, Black Michael wrote:
  
 Other places in the code are using qrand or something else. Why don't we just 
change normrnd.c to use that instead? 
  Or one of the other generators in the src code that all seem work just fine 
on XP. 
 Hi Mike, Nico is probably the best person to ask but note that this is in the 
QRA code and that has no dependencies on Qt. IMHO changing new code to make it 
work on Windows XP is wasted effort, the position with XP is pretty hopeless as 
anyone who tries to install it now will find i.e. no updates, no service packs, 
no supported web browsers. Also I expect that Qt will no longer support XP in 
new releases fairly soon.
  73
 Bill
 G4WJS.
  
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel


   
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
wsjt-devel mailing list
wsjt-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wsjt-devel

Reply via email to