From 13acd90003f5d5b65b0a6cbae510df3bdad4c778 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 13 Aug 2020 19:00:47 +0200 Subject: libtest: Use a destructor Do not set up a new test steps environment. Update #3199. --- cpukit/libtest/t-test-thread-switch.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/cpukit/libtest/t-test-thread-switch.c b/cpukit/libtest/t-test-thread-switch.c index 6457bbfd06..dd8d256c93 100644 --- a/cpukit/libtest/t-test-thread-switch.c +++ b/cpukit/libtest/t-test-thread-switch.c @@ -49,7 +49,7 @@ typedef struct { RTEMS_INTERRUPT_LOCK_MEMBER(lock) T_thread_switch_log *active; User_extensions_Control ext; - T_fixture_node node; + T_destructor dtor; } T_thread_switch_context; static void T_thread_switch_recorder(Thread_Control *, Thread_Control *); @@ -66,19 +66,14 @@ static T_thread_switch_context T_thread_switch_instance = { }; static void -T_thread_switch_teardown(void *arg) +T_thread_switch_destroy(T_destructor *dtor) { T_thread_switch_context *ctx; - ctx = arg; + ctx = RTEMS_CONTAINER_OF(dtor, T_thread_switch_context, dtor); _User_extensions_Remove_set(&ctx->ext); } -static const T_fixture T_thread_switch_fixture = { - .teardown = T_thread_switch_teardown, - .initial_context = &T_thread_switch_instance -}; - static void T_thread_switch_recorder(Thread_Control *executing, Thread_Control *heir) { @@ -125,9 +120,9 @@ T_thread_switch_record(T_thread_switch_log *log) ctx = &T_thread_switch_instance; - if (ctx->node.fixture == NULL) { + if (_Chain_Is_node_off_chain(&ctx->ext.Node)) { _User_extensions_Add_set(&ctx->ext); - T_push_fixture(&ctx->node, &T_thread_switch_fixture); + T_add_destructor(&ctx->dtor, T_thread_switch_destroy); } if (log != NULL) { -- cgit v1.2.3