mirror of
https://github.com/opnsense/src.git
synced 2026-04-09 11:27:18 -04:00
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:
parent
a68886ad51
commit
c6f2aed102
6 changed files with 9 additions and 3 deletions
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in a new issue