URI: 
       tlibthread: rm OpenBSD.c - plan9port - [fork] Plan 9 from user space
  HTML git clone git://src.adamsgaard.dk/plan9port
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit d15607b9ddd9872b48fe3ac8c68f9637044be310
   DIR parent 57157d856e4bf66326771e8036062eb6881280ca
  HTML Author: Russ Cox <rsc@swtch.com>
       Date:   Sun, 19 Jan 2020 20:51:28 -0500
       
       libthread: rm OpenBSD.c
       
       This should have been deleted in 20f5692b (2012-07-14),
       which removed the mkfile and sysofiles.sh references to it.
       
       Diffstat:
         D src/libthread/OpenBSD.c             |     145 -------------------------------
       
       1 file changed, 0 insertions(+), 145 deletions(-)
       ---
   DIR diff --git a/src/libthread/OpenBSD.c b/src/libthread/OpenBSD.c
       t@@ -1,145 +0,0 @@
       -#include "threadimpl.h"
       -#include "BSD.c"
       -
       -#include <dlfcn.h>
       -
       -struct thread_tag {
       -        struct thread_tag        *next;
       -        spinlock_t                l;
       -        volatile int                key;
       -        void                        *data;
       -};
       -
       -static spinlock_t mlock;
       -static spinlock_t dl_lock;
       -static spinlock_t tag_lock;
       -static struct thread_tag *thread_tag_store = nil;
       -static uint nextkey = 0;
       -
       -void
       -_thread_malloc_lock(void)
       -{
       -        _spinlock(&mlock);
       -}
       -
       -void
       -_thread_malloc_unlock(void)
       -{
       -        _spinunlock(&mlock);
       -}
       -
       -void
       -_thread_malloc_init(void)
       -{
       -}
       -
       -/*
       - * for ld.so
       - */
       -void
       -_thread_dl_lock(int t)
       -{
       -        if(t)
       -                _spinunlock(&dl_lock);
       -        else
       -                _spinlock(&dl_lock);
       -}
       -
       -/*
       - * for libc
       - */
       -static void
       -_thread_tag_init(void **tag)
       -{
       -        struct thread_tag *t;
       -
       -        _spinlock(&tag_lock);
       -        if(*tag == nil) {
       -                t = malloc(sizeof (*t));
       -                if(t != nil) {
       -                        memset(&t->l, 0, sizeof(t->l));
       -                        t->key = nextkey++;
       -                        *tag = t;
       -                }
       -        }
       -        _spinunlock(&tag_lock);
       -}
       -
       -void
       -_thread_tag_lock(void **tag)
       -{
       -        struct thread_tag *t;
       -
       -        if(*tag == nil)
       -                _thread_tag_init(tag);
       -        t = *tag;
       -        _spinlock(&t->l);
       -}
       -
       -void
       -_thread_tag_unlock(void **tag)
       -{
       -        struct thread_tag *t;
       -
       -        if(*tag == nil)
       -                _thread_tag_init(tag);
       -        t = *tag;
       -        _spinunlock(&t->l);
       -}
       -
       -static void *
       -_thread_tag_insert(struct thread_tag *t, void *v)
       -{
       -        t->data = v;
       -        t->next = thread_tag_store;
       -        thread_tag_store = t;
       -        return t;
       -}
       -
       -static void *
       -_thread_tag_lookup(struct thread_tag *tag, int size)
       -{
       -        struct thread_tag *t;
       -        void *p;
       -
       -        _spinlock(&tag->l);
       -        for(t = thread_tag_store; t != nil; t = t->next)
       -                if(t->key == tag->key)
       -                        break;
       -        if(t == nil) {
       -                p = malloc(size);
       -                if(p == nil) {
       -                        _spinunlock(&tag->l);
       -                        return nil;
       -                }
       -                _thread_tag_insert(tag, p);
       -        }
       -        _spinunlock(&tag->l);
       -        return tag->data;
       -}
       -
       -void *
       -_thread_tag_storage(void **tag, void *storage, size_t n, void *err)
       -{
       -        struct thread_tag *t;
       -        void *r;
       -
       -        if(*tag == nil)
       -                _thread_tag_init(tag);
       -        t = *tag;
       -
       -        r = _thread_tag_lookup(t, n);
       -        if(r == nil)
       -                r = err;
       -        else
       -                memcpy(r, storage, n);
       -        return r;
       -}
       -
       -void
       -_pthreadinit(void)
       -{
       -        __isthreaded = 1;
       -        dlctl(nil, DL_SETTHREADLCK, _thread_dl_lock);
       -        signal(SIGUSR2, sigusr2handler);
       -}