Source-Changes-HG archive

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

[src/trunk]: src/lib/librumpuser Revert conversion to __thread as breaks on a...



details:   https://anonhg.NetBSD.org/src/rev/cd0eb1f6e08f
branches:  trunk
changeset: 327559:cd0eb1f6e08f
user:      justin <justin%NetBSD.org@localhost>
date:      Mon Mar 10 22:37:51 2014 +0000

description:
Revert conversion to __thread as breaks on archs without TLS support

diffstat:

 lib/librumpuser/rumpuser_pth.c |  20 +++++++++-----------
 1 files changed, 9 insertions(+), 11 deletions(-)

diffs (68 lines):

diff -r bae267f75820 -r cd0eb1f6e08f lib/librumpuser/rumpuser_pth.c
--- a/lib/librumpuser/rumpuser_pth.c    Mon Mar 10 19:55:51 2014 +0000
+++ b/lib/librumpuser/rumpuser_pth.c    Mon Mar 10 22:37:51 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rumpuser_pth.c,v 1.35 2014/03/09 23:01:11 justin Exp $ */
+/*     $NetBSD: rumpuser_pth.c,v 1.36 2014/03/10 22:37:51 justin Exp $ */
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
 #include "rumpuser_port.h"
 
 #if !defined(lint)
-__RCSID("$NetBSD: rumpuser_pth.c,v 1.35 2014/03/09 23:01:11 justin Exp $");
+__RCSID("$NetBSD: rumpuser_pth.c,v 1.36 2014/03/10 22:37:51 justin Exp $");
 #endif /* !lint */
 
 #include <sys/queue.h>
@@ -622,15 +622,13 @@
  * curlwp
  */
 
-static __thread struct lwp *curlwp;
+static pthread_key_t curlwpkey;
 
 /*
  * the if0'd curlwp implementation is not used by this hypervisor,
  * but serves as test code to check that the intended usage works.
  */
 #if 0
-static pthread_key_t curlwpkey;
-
 struct rumpuser_lwp {
        struct lwp *l;
        LIST_ENTRY(rumpuser_lwp) l_entries;
@@ -718,12 +716,12 @@
        case RUMPUSER_LWP_DESTROY:
                break;
        case RUMPUSER_LWP_SET:
-               assert(curlwp == NULL);
-               curlwp = l;
+               assert(pthread_getspecific(curlwpkey) == NULL);
+               pthread_setspecific(curlwpkey, l);
                break;
        case RUMPUSER_LWP_CLEAR:
-               assert(curlwp == l);
-               curlwp = NULL;
+               assert(pthread_getspecific(curlwpkey) == l);
+               pthread_setspecific(curlwpkey, NULL);
                break;
        }
 }
@@ -732,7 +730,7 @@
 rumpuser_curlwp(void)
 {
 
-       return curlwp;
+       return pthread_getspecific(curlwpkey);
 }
 #endif
 
@@ -740,5 +738,5 @@
 void
 rumpuser__thrinit(void)
 {
-
+       pthread_key_create(&curlwpkey, NULL);
 }



Home | Main Index | Thread Index | Old Index