/ Check-in [d87a886d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Remove the call to srand() and add better comments to the sqliteOsRandomSeed() routine. Ticket #163. (CVS 759)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:d87a886d8f63f54466848151e2b0e8565b338593
User & Date: drh 2002-10-12 13:44:00
Context
2002-10-17
00:38
fix for locking in Windows (CVS 760) check-in: 83add34f user: mike tags: trunk
2002-10-12
13:44
Remove the call to srand() and add better comments to the sqliteOsRandomSeed() routine. Ticket #163. (CVS 759) check-in: d87a886d user: drh tags: trunk
2002-09-30
12:36
Fix a bug in the left outer join logic. (CVS 758) check-in: 6c0f44bd user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/os.c.

784
785
786
787
788
789
790
791


792
793
794
795
796
797
798
799
800
801
...
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
    id->locked = 0;
  }
  return rc;
#endif
}

/*
** Get information to seed the random number generator.


*/
int sqliteOsRandomSeed(char *zBuf){
  static int once = 1;
#ifdef SQLITE_TEST
  /* When testing, always use the same random number sequence.
  ** This makes the tests repeatable.
  */
  memset(zBuf, 0, 256);
#endif
#if OS_UNIX && !defined(SQLITE_TEST)
................................................................................
  time((time_t*)zBuf);
  pid = getpid();
  memcpy(&zBuf[sizeof(time_t)], &pid, sizeof(pid));
#endif
#if OS_WIN && !defined(SQLITE_TEST)
  GetSystemTime((LPSYSTEMTIME)zBuf);
#endif
  if( once ){
    int seed;
    memcpy(&seed, zBuf, sizeof(seed));
    srand(seed);
    once = 0;
  }
  return SQLITE_OK;
}

/*
** Sleep for a little while.  Return the amount of time slept.
*/
int sqliteOsSleep(int ms){







|
>
>


<







 







<
<
<
<
<
<







784
785
786
787
788
789
790
791
792
793
794
795

796
797
798
799
800
801
802
...
804
805
806
807
808
809
810






811
812
813
814
815
816
817
    id->locked = 0;
  }
  return rc;
#endif
}

/*
** Get information to seed the random number generator.  The seed
** is written into the buffer zBuf[256].  The calling function must
** supply a sufficiently large buffer.
*/
int sqliteOsRandomSeed(char *zBuf){

#ifdef SQLITE_TEST
  /* When testing, always use the same random number sequence.
  ** This makes the tests repeatable.
  */
  memset(zBuf, 0, 256);
#endif
#if OS_UNIX && !defined(SQLITE_TEST)
................................................................................
  time((time_t*)zBuf);
  pid = getpid();
  memcpy(&zBuf[sizeof(time_t)], &pid, sizeof(pid));
#endif
#if OS_WIN && !defined(SQLITE_TEST)
  GetSystemTime((LPSYSTEMTIME)zBuf);
#endif






  return SQLITE_OK;
}

/*
** Sleep for a little while.  Return the amount of time slept.
*/
int sqliteOsSleep(int ms){