diff --git a/sys/kern/kern_kse.c b/sys/kern/kern_kse.c index 4c692e5eda7b..18b55d5ef658 100644 --- a/sys/kern/kern_kse.c +++ b/sys/kern/kern_kse.c @@ -1087,7 +1087,9 @@ thread_statclock(int user) return (-1); if (user) { /* Current always do via ast() */ + mtx_lock_spin(&sched_lock); td->td_flags |= (TDF_USTATCLOCK|TDF_ASTPENDING); + mtx_unlock_spin(&sched_lock); td->td_uuticks++; } else { if (td->td_mailbox != NULL) diff --git a/sys/kern/kern_thread.c b/sys/kern/kern_thread.c index 4c692e5eda7b..18b55d5ef658 100644 --- a/sys/kern/kern_thread.c +++ b/sys/kern/kern_thread.c @@ -1087,7 +1087,9 @@ thread_statclock(int user) return (-1); if (user) { /* Current always do via ast() */ + mtx_lock_spin(&sched_lock); td->td_flags |= (TDF_USTATCLOCK|TDF_ASTPENDING); + mtx_unlock_spin(&sched_lock); td->td_uuticks++; } else { if (td->td_mailbox != NULL)