Properly initialize the last active time of the initial thread. This fixes
the case that a CPU hungry main thread is prevented from being preempted due to a negative calculation of its time slice. Reported by: Alexander Litvin <archer@lucky.net>
This commit is contained in:
parent
85dd55e473
commit
7e416d8e49
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=56236
@ -90,6 +90,7 @@ _thread_init(void)
|
||||
int i;
|
||||
size_t len;
|
||||
int mib[2];
|
||||
struct timeval tv;
|
||||
struct clockinfo clockinfo;
|
||||
struct sigaction act;
|
||||
|
||||
@ -223,6 +224,11 @@ _thread_init(void)
|
||||
TAILQ_INIT(&(_thread_initial->mutexq));
|
||||
_thread_initial->priority_mutex_count = 0;
|
||||
|
||||
/* Initialize last active time to now: */
|
||||
gettimeofday(&tv, NULL);
|
||||
_thread_initial->last_active.tv_sec = tv.tv_sec;
|
||||
_thread_initial->last_active.tv_usec = tv.tv_usec;
|
||||
|
||||
/* Initialise the rest of the fields: */
|
||||
_thread_initial->poll_data.nfds = 0;
|
||||
_thread_initial->poll_data.fds = NULL;
|
||||
|
@ -90,6 +90,7 @@ _thread_init(void)
|
||||
int i;
|
||||
size_t len;
|
||||
int mib[2];
|
||||
struct timeval tv;
|
||||
struct clockinfo clockinfo;
|
||||
struct sigaction act;
|
||||
|
||||
@ -223,6 +224,11 @@ _thread_init(void)
|
||||
TAILQ_INIT(&(_thread_initial->mutexq));
|
||||
_thread_initial->priority_mutex_count = 0;
|
||||
|
||||
/* Initialize last active time to now: */
|
||||
gettimeofday(&tv, NULL);
|
||||
_thread_initial->last_active.tv_sec = tv.tv_sec;
|
||||
_thread_initial->last_active.tv_usec = tv.tv_usec;
|
||||
|
||||
/* Initialise the rest of the fields: */
|
||||
_thread_initial->poll_data.nfds = 0;
|
||||
_thread_initial->poll_data.fds = NULL;
|
||||
|
@ -90,6 +90,7 @@ _thread_init(void)
|
||||
int i;
|
||||
size_t len;
|
||||
int mib[2];
|
||||
struct timeval tv;
|
||||
struct clockinfo clockinfo;
|
||||
struct sigaction act;
|
||||
|
||||
@ -223,6 +224,11 @@ _thread_init(void)
|
||||
TAILQ_INIT(&(_thread_initial->mutexq));
|
||||
_thread_initial->priority_mutex_count = 0;
|
||||
|
||||
/* Initialize last active time to now: */
|
||||
gettimeofday(&tv, NULL);
|
||||
_thread_initial->last_active.tv_sec = tv.tv_sec;
|
||||
_thread_initial->last_active.tv_usec = tv.tv_usec;
|
||||
|
||||
/* Initialise the rest of the fields: */
|
||||
_thread_initial->poll_data.nfds = 0;
|
||||
_thread_initial->poll_data.fds = NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user