summaryrefslogtreecommitdiffstatsabout
path: root/SylixOS
diff options
context:
space:
mode:
authorHanhui <hanhui@acoinfo.com>2020-08-10 07:57:18 (GMT)
committer Hanhui <hanhui@acoinfo.com>2020-08-10 07:57:18 (GMT)
commit7e21b747d60b8a1cb79424787b06092542d2b6ff (patch)
treecdc26e3f7f65b7d0434f70d1acde3dd506e253a9 /SylixOS
parent12237f88929a07d481a803d32ba07ab35bcf1eec (diff)
downloadlibsylixos-7e21b747d60b8a1cb79424787b06092542d2b6ff.zip
libsylixos-7e21b747d60b8a1cb79424787b06092542d2b6ff.tar.gz
libsylixos-7e21b747d60b8a1cb79424787b06092542d2b6ff.tar.bz2
Timer high resolution requires kernel time lock protection.
Diffstat (limited to 'SylixOS')
-rw-r--r--SylixOS/lib/libc/time/lib_clock.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/SylixOS/lib/libc/time/lib_clock.c b/SylixOS/lib/libc/time/lib_clock.c
index 48201ab..ebe5c72 100644
--- a/SylixOS/lib/libc/time/lib_clock.c
+++ b/SylixOS/lib/libc/time/lib_clock.c
@@ -165,7 +165,9 @@ INT lib_clock_gettime (clockid_t clockid, struct timespec *tv)
}
LW_SPIN_KERN_LOCK_QUICK(&iregInterLevel);
__tickToTimespec(pvproc->VP_clockUser + pvproc->VP_clockSystem, tv);
+ LW_SPIN_KERN_TIME_LOCK_IGNIRQ();
LW_TIME_HIGH_RESOLUTION(tv);
+ LW_SPIN_KERN_TIME_UNLOCK_IGNIRQ();
LW_SPIN_KERN_UNLOCK_QUICK(iregInterLevel);
}
#else
@@ -178,7 +180,9 @@ INT lib_clock_gettime (clockid_t clockid, struct timespec *tv)
LW_SPIN_KERN_LOCK_QUICK(&iregInterLevel);
LW_TCB_GET_CUR(ptcbCur);
__tickToTimespec(ptcbCur->TCB_ulCPUTicks, tv);
+ LW_SPIN_KERN_TIME_LOCK_IGNIRQ();
LW_TIME_HIGH_RESOLUTION(tv);
+ LW_SPIN_KERN_TIME_UNLOCK_IGNIRQ();
LW_SPIN_KERN_UNLOCK_QUICK(iregInterLevel);
break;