Update #3199.
---
 cpukit/libtest/t-test.c | 64 ++++++++++++++++++++++-------------------
 1 file changed, 34 insertions(+), 30 deletions(-)

diff --git a/cpukit/libtest/t-test.c b/cpukit/libtest/t-test.c
index e8d0542c31..92aed62b9b 100644
--- a/cpukit/libtest/t-test.c
+++ b/cpukit/libtest/t-test.c
@@ -92,6 +92,40 @@ const T_check_context T_special = {
        .flags = T_CHECK_FMT | T_CHECK_QUIET
 };
 
+static bool
+T_do_is_runner(T_context *ctx)
+{
+       bool is_runner;
+#ifdef __rtems__
+       ISR_Level level;
+       const Per_CPU_Control *cpu_self;
+#endif
+
+#ifdef __rtems__
+       _ISR_Local_disable(level);
+       cpu_self = _Per_CPU_Get();
+
+       if (ctx->runner_thread != NULL) {
+               is_runner = cpu_self->isr_nest_level == 0 &&
+                   _Per_CPU_Get_executing(cpu_self) == ctx->runner_thread;
+       } else {
+               is_runner = cpu_self == ctx->runner_cpu;
+       }
+
+       _ISR_Local_enable(level);
+#else
+       is_runner = ctx->runner_valid &&
+           pthread_equal(pthread_self(), ctx->runner_thread) != 0;
+#endif
+
+       return is_runner;
+}
+
+bool T_is_runner(void)
+{
+       return T_do_is_runner(&T_instance);
+}
+
 typedef struct {
        char *s;
        size_t n;
@@ -952,36 +986,6 @@ T_main(const T_config *config)
        return T_do_run_finalize(ctx) ? 0 : 1;
 }
 
-bool T_is_runner(void)
-{
-       T_context *ctx;
-       bool is_runner;
-#ifdef __rtems__
-       ISR_Level level;
-       const Per_CPU_Control *cpu_self;
-#endif
-
-       ctx = &T_instance;
-#ifdef __rtems__
-       _ISR_Local_disable(level);
-       cpu_self = _Per_CPU_Get();
-
-       if (ctx->runner_thread != NULL) {
-               is_runner = cpu_self->isr_nest_level == 0 &&
-                   _Per_CPU_Get_executing(cpu_self) == ctx->runner_thread;
-       } else {
-               is_runner = cpu_self == ctx->runner_cpu;
-       }
-
-       _ISR_Local_enable(level);
-#else
-       is_runner = ctx->runner_valid &&
-           pthread_equal(pthread_self(), ctx->runner_thread) != 0;
-#endif
-
-       return is_runner;
-}
-
 #ifdef __rtems__
 RTEMS_LINKER_ROSET(_T, T_case_context *);
 #endif /* __rtems__ */
-- 
2.26.2

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to