Source-Changes-HG archive

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

[src/trunk]: src/lib/librumpuser Move makecontext into function with getconte...



details:   https://anonhg.NetBSD.org/src/rev/8dd1115c049e
branches:  trunk
changeset: 333562:8dd1115c049e
user:      justin <justin%NetBSD.org@localhost>
date:      Sat Nov 08 23:20:23 2014 +0000

description:
Move makecontext into function with getcontext for consistency

diffstat:

 lib/librumpuser/rumpfiber.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (50 lines):

diff -r 3a706df67092 -r 8dd1115c049e lib/librumpuser/rumpfiber.c
--- a/lib/librumpuser/rumpfiber.c       Sat Nov 08 21:27:04 2014 +0000
+++ b/lib/librumpuser/rumpfiber.c       Sat Nov 08 23:20:23 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpfiber.c,v 1.6 2014/11/08 21:27:04 justin Exp $     */
+/*     $NetBSD: rumpfiber.c,v 1.7 2014/11/08 23:20:23 justin Exp $     */
 
 /*
  * Copyright (c) 2007-2013 Antti Kantee.  All Rights Reserved.
@@ -68,7 +68,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpfiber.c,v 1.6 2014/11/08 21:27:04 justin Exp $");
+__RCSID("$NetBSD: rumpfiber.c,v 1.7 2014/11/08 23:20:23 justin Exp $");
 #endif /* !lint */
 
 #include <sys/ioctl.h>
@@ -181,7 +181,8 @@
 }
 
 static void
-create_ctx(ucontext_t *ctx, void *stack, size_t stack_size)
+create_ctx(ucontext_t *ctx, void *stack, size_t stack_size,
+       void (*f)(void *), void *data)
 {
 
        getcontext(ctx);
@@ -189,9 +190,10 @@
        ctx->uc_stack.ss_size = stack_size;
        ctx->uc_stack.ss_flags = 0;
        ctx->uc_link = NULL; /* TODO may link to main thread */
+       /* may have to do bounce function to call, if args to makecontext are ints */
+       makecontext(ctx, (void (*)(void))f, 1, data);
 }
 
-/* may have to do bounce function to call, if args to makecontext are ints */
 /* TODO see notes in rumpuser_thread_create, have flags here */
 struct thread *
 create_thread(const char *name, void *cookie, void (*f)(void *), void *data,
@@ -215,8 +217,7 @@
        } else {
                thread->flags = THREAD_EXTSTACK;
        }
-       create_ctx(&thread->ctx, stack, stack_size);
-       makecontext(&thread->ctx, (void (*)(void))f, 1, data);
+       create_ctx(&thread->ctx, stack, stack_size, f, data);
        
        thread->name = strdup(name);
        thread->cookie = cookie;



Home | Main Index | Thread Index | Old Index