aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/posix-cpu-timers.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/posix-cpu-timers.c')
-rw-r--r--kernel/posix-cpu-timers.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/kernel/posix-cpu-timers.c b/kernel/posix-cpu-timers.c
index cce2f0b2d406..7d9d0fab1651 100644
--- a/kernel/posix-cpu-timers.c
+++ b/kernel/posix-cpu-timers.c
@@ -615,7 +615,12 @@ static void arm_timer(struct k_itimer *timer)
615 */ 615 */
616static void cpu_timer_fire(struct k_itimer *timer) 616static void cpu_timer_fire(struct k_itimer *timer)
617{ 617{
618 if (unlikely(timer->sigq == NULL)) { 618 if ((timer->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) {
619 /*
620 * User don't want any signal.
621 */
622 timer->it.cpu.expires.sched = 0;
623 } else if (unlikely(timer->sigq == NULL)) {
619 /* 624 /*
620 * This a special case for clock_nanosleep, 625 * This a special case for clock_nanosleep,
621 * not a normal timer from sys_timer_create. 626 * not a normal timer from sys_timer_create.
@@ -784,7 +789,6 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags,
784 */ 789 */
785 timer->it.cpu.expires = new_expires; 790 timer->it.cpu.expires = new_expires;
786 if (new_expires.sched != 0 && 791 if (new_expires.sched != 0 &&
787 (timer->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE &&
788 cpu_time_before(timer->it_clock, val, new_expires)) { 792 cpu_time_before(timer->it_clock, val, new_expires)) {
789 arm_timer(timer); 793 arm_timer(timer);
790 } 794 }
@@ -809,7 +813,6 @@ int posix_cpu_timer_set(struct k_itimer *timer, int flags,
809 timer->it_overrun = -1; 813 timer->it_overrun = -1;
810 814
811 if (new_expires.sched != 0 && 815 if (new_expires.sched != 0 &&
812 (timer->it_sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE &&
813 !cpu_time_before(timer->it_clock, val, new_expires)) { 816 !cpu_time_before(timer->it_clock, val, new_expires)) {
814 /* 817 /*
815 * The designated time already passed, so we notify 818 * The designated time already passed, so we notify
@@ -883,25 +886,6 @@ void posix_cpu_timer_get(struct k_itimer *timer, struct itimerspec *itp)
883 read_unlock(&tasklist_lock); 886 read_unlock(&tasklist_lock);
884 } 887 }
885 888
886 if ((timer->it_sigev_notify & ~SIGEV_THREAD_ID) == SIGEV_NONE) {
887 if (timer->it.cpu.incr.sched == 0 &&
888 cpu_time_before(timer->it_clock,
889 timer->it.cpu.expires, now)) {
890 /*
891 * Do-nothing timer expired and has no reload,
892 * so it's as if it was never set.
893 */
894 timer->it.cpu.expires.sched = 0;
895 itp->it_value.tv_sec = itp->it_value.tv_nsec = 0;
896 return;
897 }
898 /*
899 * Account for any expirations and reloads that should
900 * have happened.
901 */
902 bump_cpu_timer(timer, now);
903 }
904
905 if (unlikely(clear_dead)) { 889 if (unlikely(clear_dead)) {
906 /* 890 /*
907 * We've noticed that the thread is dead, but 891 * We've noticed that the thread is dead, but