libroot/posix/stdio: Remove unused portions.
[haiku.git] / src / system / libroot / os / arch / arm / tls.c
blob79c0a5a6327b048706c73df81053edcf25c8fd01
1 /*
2 ** Copyright 2003, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
3 ** Distributed under the terms of the MIT License.
4 */
6 // ToDo: this is a dummy implementation - I've not yet gained enough knowledge
7 // to decide how this should be done, so it's just broken now (okay for single
8 // threaded apps, though).
10 // we don't want to have the inline assembly included here
11 #ifndef _NO_INLINE_ASM
12 # define _NO_INLINE_ASM 1
13 #endif
15 #include "support/TLS.h"
16 #include "tls.h"
19 static int32 gNextSlot = TLS_FIRST_FREE_SLOT;
20 static void *gSlots[TLS_MAX_KEYS];
23 int32
24 tls_allocate(void)
26 int32 next = atomic_add(&gNextSlot, 1);
27 if (next >= TLS_MAX_KEYS)
28 return B_NO_MEMORY;
30 return next;
34 void *
35 tls_get(int32 index)
37 return gSlots[index];
41 void **
42 tls_address(int32 index)
44 return &gSlots[index];
48 void
49 tls_set(int32 index, void *value)
51 gSlots[index] = value;