nuttx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [incubator-nuttx] sebastianene07 commented on a change in pull request #1009: Add support for preemptive scheduling in simulator build
Date Sat, 09 May 2020 13:07:27 GMT

sebastianene07 commented on a change in pull request #1009:
URL: https://github.com/apache/incubator-nuttx/pull/1009#discussion_r422493854



##########
File path: arch/sim/src/sim/up_timer.c
##########
@@ -0,0 +1,169 @@
+/****************************************************************************
+ * arch/sim/src/sim/up_timer.c
+ *
+ *   Copyright (C) 2014, 2019 Gregory Nutt. All rights reserved.
+ *   Author: Gregory Nutt <gnutt@nuttx.org>
+ *           Sebastian Ene <sebastian.ene07@gmail.com>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ * 3. Neither the name NuttX nor the names of its contributors may be
+ *    used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdbool.h>
+#include <string.h>
+#include <stdint.h>
+#include <stdarg.h>
+
+#include <sys/types.h>
+#include <sys/time.h>
+#include <sys/wait.h>
+
+#include "../../../../include/nuttx/config.h"
+
+/****************************************************************************
+ * Private Types
+ ****************************************************************************/
+
+typedef void (*sched_timer_callback_t)(void);
+
+/****************************************************************************
+ * Private Data
+ ****************************************************************************/
+
+static sched_timer_callback_t g_sched_process_timer_cb;
+
+/****************************************************************************
+ * Private Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: host_signal_handler
+ *
+ * Description:
+ *  The signal handler is called periodically and is used to deliver TICK
+ *  events to the OS.
+ *
+ ****************************************************************************/
+static void host_signal_handler(int sig, siginfo_t *si, void *old_ucontext)
+{
+  g_sched_process_timer_cb();

Review comment:
       Most of the operations in ```nxsched_process_timer``` are done in a critical section.
In our case ```up_irq_save``` calls ```host_signal_save``` which masks the signal in the current
host thread.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message