xiaoxiang781216 commented on code in PR #20130:
URL: https://github.com/apache/nuttx/pull/20130#discussion_r4011216379
##########
sched/timer/timer_create.c:
##########
@@ -196,6 +200,24 @@ int timer_create(clockid_t clockid, FAR struct sigevent
*evp,
/* Yes, copy the entire struct sigevent content */
memcpy(&ret->pt_event, evp, sizeof(struct sigevent));
+
+#if defined(CONFIG_FDPIC) && defined(CONFIG_SIG_EVTHREAD)
+ /* Resolve the callback and take the data base here, where
+ * this still runs in the module's context. The callback
+ * fires later on a worker that carries neither. The function
+ * shares a union with the thread ID, so only a SIGEV_THREAD
+ * event has one to resolve.
+ */
+
+ if ((evp->sigev_notify & SIGEV_THREAD) != 0)
+ {
+ ret->pt_event.sigev_notify_function =
+ (sigev_notify_function_t)fdpic_callback(
+ (FAR void *)evp->sigev_notify_function);
+ }
+
+ ret->pt_work.got = fdpic_base();
Review Comment:
why not save got base into fdpic_desc_s pointed by sigev_notify_function?
BTW, why `fdpic_invoke` doesn't take `struct fdpic_desc_s *` as a parameter:
```
static inline void fdpic_invoke(uintptr_t arg, FAR struct fdpic_desc_s
*desc);
```
##########
sched/task/task_create.c:
##########
@@ -202,8 +206,18 @@ int task_create_with_stack(FAR const char *name, int
priority,
FAR void *stack_addr, int stack_size,
main_t entry, FAR char * const argv[])
{
- int ret = nxtask_create(name, priority, stack_addr,
- stack_size, entry, argv, NULL);
+ int ret;
+
+#ifdef CONFIG_FDPIC
+ /* Resolve here, once: this covers task_create() too, which is a plain
+ * forwarder. The new task inherits the creator's D-Space.
+ */
+
+ entry = (main_t)fdpic_callback((FAR void *)entry);
Review Comment:
but why not change the invocation point by fdpic_invoke instead?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]