ThreadLocalStorage impl

Implements ThreadLocalStorage.

Summary
ThreadLocalStorage implImplements ThreadLocalStorage.
CopyrightThis program is free software.
Files
C-kern/api/platform/task/thread_tls.hHeader file ThreadLocalStorage.
C-kern/platform/Linux/task/thread_tls.cImplementation file ThreadLocalStorage impl.
thread_vars_tVariables stored in thread local storage.
lifetime
thread_vars_INIT_STATICStatic initializer.
thread_tls_t
static variables
s_threadtls_errtimerSimulates an error in <init_threadtls> and <free_threadtls>.
helper
sizesignalstack_threadtlsReturns the minimum size of the signal stack.
sizestack_threadtlsReturns the default size of the thread stack.
sizevars_threadtlsReturns the size of all local thread variables on the stack.
lifetime
query
threadstack_threadtls(const thread_tls_t * tls)Returns the thread stack from tls.
test

Copyright

This program is free software.  You can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.

Author

© 2013 Jörg Seebohn

Files

C-kern/api/platform/task/thread_tls.h

Header file ThreadLocalStorage.

C-kern/platform/Linux/task/thread_tls.c

Implementation file ThreadLocalStorage impl.

thread_vars_t

struct thread_vars_t

Variables stored in thread local storage.

Summary

lifetime

thread_vars_INIT_STATIC

#define thread_vars_INIT_STATIC { threadcontext_INIT_STATIC, thread_FREE }

Static initializer.  Used to initialize all variables of thread locval storage.

thread_tls_t

Summary
static variables
s_threadtls_errtimerSimulates an error in <init_threadtls> and <free_threadtls>.
helper
sizesignalstack_threadtlsReturns the minimum size of the signal stack.
sizestack_threadtlsReturns the default size of the thread stack.
sizevars_threadtlsReturns the size of all local thread variables on the stack.
lifetime
query
threadstack_threadtls(const thread_tls_t * tls)Returns the thread stack from tls.
test

static variables

s_threadtls_errtimer

static test_errortimer_t s_threadtls_errtimer

Simulates an error in <init_threadtls> and <free_threadtls>.

helper

sizesignalstack_threadtls

static inline size_t sizesignalstack_threadtls(const size_t pagesize)

Returns the minimum size of the signal stack.  The returned value is a multiple of pagesize.

sizestack_threadtls

static inline size_t sizestack_threadtls(const size_t pagesize)

Returns the default size of the thread stack.  The returned value is a multiple of pagesize.

sizevars_threadtls

static inline size_t sizevars_threadtls(const size_t pagesize)

Returns the size of all local thread variables on the stack.  The returned value is a multiple of pagesize.

lifetime

query

threadstack_threadtls(const thread_tls_t * tls)

void threadstack_threadtls(const thread_tls_t *tls,
/*out*/struct memblock_t *stackmem)

Returns the thread stack from tls.

test

Supports storage (variables and stack space) for every creatd thread and the main thread.
Implements ThreadLocalStorage.
struct thread_vars_t
Variables stored in thread local storage.
#define thread_vars_INIT_STATIC { threadcontext_INIT_STATIC, thread_FREE }
Static initializer.
static test_errortimer_t s_threadtls_errtimer
Simulates an error in init_threadtls and free_threadtls.
static inline size_t sizesignalstack_threadtls(const size_t pagesize)
Returns the minimum size of the signal stack.
static inline size_t sizestack_threadtls(const size_t pagesize)
Returns the default size of the thread stack.
static inline size_t sizevars_threadtls(const size_t pagesize)
Returns the size of all local thread variables on the stack.
void threadstack_threadtls(const thread_tls_t *tls,
/*out*/struct memblock_t *stackmem)
Returns the thread stack from tls.
Close