Limit threads clock resolution to no less than 1000usec (1000Hz).

PR:		25300
Submitted by:	Tom Pavel <pavel@alum.mit.edu> (in part)
This commit is contained in:
deischen 2001-02-26 01:05:33 +00:00
parent 868cd470b4
commit d9ad338640
6 changed files with 9 additions and 3 deletions

View File

@ -459,6 +459,7 @@ enum pthread_susp {
* Clock resolution in microseconds.
*/
#define CLOCK_RES_USEC 10000
#define CLOCK_RES_USEC_MIN 1000
/*
* Time slice period in microseconds.

View File

@ -414,7 +414,8 @@ _thread_init(void)
mib[1] = KERN_CLOCKRATE;
len = sizeof (struct clockinfo);
if (sysctl(mib, 2, &clockinfo, &len, NULL, 0) == 0)
_clock_res_usec = clockinfo.tick;
_clock_res_usec = clockinfo.tick > CLOCK_RES_USEC_MIN ?
clockinfo.tick : CLOCK_RES_USEC_MIN;
/* Get the table size: */
if ((_thread_dtablesize = getdtablesize()) < 0) {

View File

@ -414,7 +414,8 @@ _thread_init(void)
mib[1] = KERN_CLOCKRATE;
len = sizeof (struct clockinfo);
if (sysctl(mib, 2, &clockinfo, &len, NULL, 0) == 0)
_clock_res_usec = clockinfo.tick;
_clock_res_usec = clockinfo.tick > CLOCK_RES_USEC_MIN ?
clockinfo.tick : CLOCK_RES_USEC_MIN;
/* Get the table size: */
if ((_thread_dtablesize = getdtablesize()) < 0) {

View File

@ -459,6 +459,7 @@ enum pthread_susp {
* Clock resolution in microseconds.
*/
#define CLOCK_RES_USEC 10000
#define CLOCK_RES_USEC_MIN 1000
/*
* Time slice period in microseconds.

View File

@ -414,7 +414,8 @@ _thread_init(void)
mib[1] = KERN_CLOCKRATE;
len = sizeof (struct clockinfo);
if (sysctl(mib, 2, &clockinfo, &len, NULL, 0) == 0)
_clock_res_usec = clockinfo.tick;
_clock_res_usec = clockinfo.tick > CLOCK_RES_USEC_MIN ?
clockinfo.tick : CLOCK_RES_USEC_MIN;
/* Get the table size: */
if ((_thread_dtablesize = getdtablesize()) < 0) {

View File

@ -459,6 +459,7 @@ enum pthread_susp {
* Clock resolution in microseconds.
*/
#define CLOCK_RES_USEC 10000
#define CLOCK_RES_USEC_MIN 1000
/*
* Time slice period in microseconds.