Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libpthread Simplify - it's enough to set nctx.uc_l...



details:   https://anonhg.NetBSD.org/src/rev/8092bcaee457
branches:  trunk
changeset: 830205:8092bcaee457
user:      uwe <uwe%NetBSD.org@localhost>
date:      Wed Feb 28 21:36:50 2018 +0000

description:
Simplify - it's enough to set nctx.uc_link to &octx to restore old
context automatically when swapfunc() returns.

diffstat:

 tests/lib/libpthread/t_swapcontext.c |  10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diffs (38 lines):

diff -r 4d843cea8c65 -r 8092bcaee457 tests/lib/libpthread/t_swapcontext.c
--- a/tests/lib/libpthread/t_swapcontext.c      Wed Feb 28 21:29:10 2018 +0000
+++ b/tests/lib/libpthread/t_swapcontext.c      Wed Feb 28 21:36:50 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_swapcontext.c,v 1.8 2018/02/28 21:29:10 uwe Exp $ */
+/* $NetBSD: t_swapcontext.c,v 1.9 2018/02/28 21:36:50 uwe Exp $ */
 
 /*
  * Copyright (c) 2012 Emmanuel Dreyfus. All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_swapcontext.c,v 1.8 2018/02/28 21:29:10 uwe Exp $");
+__RCSID("$NetBSD: t_swapcontext.c,v 1.9 2018/02/28 21:36:50 uwe Exp $");
 
 #include <sys/types.h>
 #include <errno.h>
@@ -61,11 +61,6 @@
 
        ATF_REQUIRE_EQ(oself, nself);
        printf("Test succeeded\n");
-       /* Go back in main */
-       ATF_REQUIRE(swapcontext(&nctx, &octx));
-
-       /* NOTREACHED */
-       return;
 }
 
 /* ARGSUSED0 */
@@ -74,6 +69,7 @@
 {
        nctx.uc_stack.ss_sp = stack;
        nctx.uc_stack.ss_size = sizeof(stack);
+       nctx.uc_link = &octx;
 
        makecontext(&nctx, swapfunc, 0);
 



Home | Main Index | Thread Index | Old Index