From 23d5d48ebeaa9edb1b92e5c6c015588fb9af89f0 Mon Sep 17 00:00:00 2001 From: Kiita Date: Thu, 3 Jun 2021 20:43:41 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20timer=5Fcreate=E6=94=AF=E6=8C=81?= =?UTF-8?q?=E4=BB=A5SIGEV=5FTHREAD=E6=96=B9=E5=BC=8F=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=AE=9A=E6=97=B6=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 【背景】当前timer_create接口不支持以SIGEV_THREAD的方式创建多个定时器 【修改方案】 1、内核timer_create接口在创建software timers相应的线程时,使用线程 taskCB所携带的信息识别各个线程的信号并依据该信息分别派发出信号。 2、关于用户任务操作许可验证的修改,现在允许同一用户线程向其自身派发信 号,软件定时器计时结束,向用户态发送相应的信号,完成用户态线程的回调。 【影响】 对现有的产品暂无影响。 re #I3SRFI Signed-off-by: yansira Change-Id: I338e39068ed3310db30d434ffd74b6abeecb345d --- kernel/include/signal.h | 7 +++++++ kernel/include/time.h | 4 ++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/kernel/include/signal.h b/kernel/include/signal.h index 50ebb1bf7..de862d90f 100644 --- a/kernel/include/signal.h +++ b/kernel/include/signal.h @@ -152,6 +152,13 @@ struct sigevent { void *sigev_notify_attributes; }; +struct ksigevent { + union sigval sigev_value; + int sigev_signo; + int sigev_notify; + int sigev_tid; +}; + #define SIGEV_SIGNAL 0 #define SIGEV_NONE 1 #define SIGEV_THREAD 2 diff --git a/kernel/include/time.h b/kernel/include/time.h index 7c7b34776..a7de0e7ae 100644 --- a/kernel/include/time.h +++ b/kernel/include/time.h @@ -118,8 +118,8 @@ int clock_settime (clockid_t, const struct timespec *); int clock_nanosleep (clockid_t, int, const struct timespec *, struct timespec *); int clock_getcpuclockid (pid_t, clockid_t *); -struct sigevent; -int timer_create (clockid_t, struct sigevent *__restrict, timer_t *__restrict); +struct ksigevent; +int OsTimerCreate (clockid_t, struct ksigevent *__restrict, timer_t *__restrict); int timer_delete (timer_t); int timer_settime (timer_t, int, const struct itimerspec *__restrict, struct itimerspec *__restrict); int timer_gettime (timer_t, struct itimerspec *); -- Gitee