casaroli commented on code in PR #20130:
URL: https://github.com/apache/nuttx/pull/20130#discussion_r4036792187
##########
sched/timer/timer_create.c:
##########
@@ -196,6 +200,30 @@ 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 here, where this still runs in the
+ * module's context. It fires later on a worker that carries
+ * no data base, so the base travels with it. The descriptor
+ * holds the base of the module the callback belongs to,
+ * which is not always the caller's. The function shares a
+ * union with the thread ID, so only a SIGEV_THREAD event has
+ * one to resolve.
+ */
+
+ ret->pt_work.desc.got = 0;
+
+ if ((evp->sigev_notify & SIGEV_THREAD) != 0 &&
+ fdpic_base() != 0)
+ {
+ FAR struct fdpic_desc_s *desc =
Review Comment:
Done, except the base comes from the descriptor rather than fdpic_base(),
which is only the test: a module can register a callback belonging to another
module
##########
sched/signal/sig_notification.c:
##########
@@ -70,7 +74,23 @@ static void nxsig_notification_worker(FAR void *arg)
/* Perform the callback */
+#ifdef CONFIG_FDPIC
+ /* The worker does not carry the module's data base. Install the base
+ * captured at registration around the call. A zero base means the
+ * callback is not a module's.
+ */
+
+ if (work->desc.got != 0)
Review Comment:
Done
--
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]