Added a dumb TLS implementation rather than printing an error.
Will properly implement TLS soon, for now a "working" implementation is needed for anything to work properly.
This commit is contained in:
@@ -18,33 +18,37 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
|
|
||||||
|
static int32 gNextSlot = TLS_FIRST_FREE_SLOT;
|
||||||
|
static void* gSlots[TLS_MAX_KEYS];
|
||||||
|
|
||||||
|
|
||||||
int32
|
int32
|
||||||
tls_allocate(void)
|
tls_allocate(void)
|
||||||
{
|
{
|
||||||
assert(0 && "tls_allocate: not implemented");
|
int32 next = atomic_add(&gNextSlot, 1);
|
||||||
return 0;
|
if (next >= TLS_MAX_KEYS)
|
||||||
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void*
|
void*
|
||||||
tls_get(int32 index)
|
tls_get(int32 index)
|
||||||
{
|
{
|
||||||
assert(0 && "tls_get: not implemented");
|
return gSlots[index];
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void**
|
void**
|
||||||
tls_address(int32 index)
|
tls_address(int32 index)
|
||||||
{
|
{
|
||||||
assert(0 && "tls_address: not implemented");
|
return &gSlots[index];
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
tls_set(int32 index, void* value)
|
tls_set(int32 index, void* value)
|
||||||
{
|
{
|
||||||
assert(0 && "tls_set: not implemented");
|
gSlots[index] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user