LinuxSystemContext

Defines sys_context_threadtls and other thread context specific functions.  The defined functions are implemented inline to speed up performance.

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

© 2012 Jörg Seebohn

Files

C-kern/api/platform/Linux/syscontext.h

Header file LinuxSystemContext.

C-kern/konfig.h

Included from header Konfiguration.

thread_tls_t

struct thread_tls_t
Summary
Functions
sys_context_threadtlsReturns threadcontext_t of the current thread.
sys_context2_threadtlsReturns threadcontext_t of the current thread.
sys_size_threadtlsReturns the size in bytes of the thread local storage.
sys_thread_threadtlsReturns current thread_t object.

Functions

sys_context_threadtls

struct threadcontext_t * sys_context_threadtls(void)

Returns threadcontext_t of the current thread.  This function is called from all other functions using threadcontext_t.  The returned pointer is calculated relative to the address of the current stack.

sys_context2_threadtls

struct threadcontext_t * sys_context2_threadtls(void *local_var)

Returns threadcontext_t of the current thread.  The parameter local_var must point to a local variable on the current stack.  This function is called from sys_context_threadtls.

sys_size_threadtls

size_t sys_size_threadtls(void)

Returns the size in bytes of the thread local storage.  This size is reserved for every created thread and the main thread.  The size includes the stack and the signal stack size.

sys_thread_threadtls

struct thread_t * sys_thread_threadtls(void)

Returns current thread_t object.  Calls sys_context_threadtls and adds a constant offset.

Macros

sys_context_threadtls

#define sys_context_threadtls(
   
) ( __extension__ ({ int _addr ; sys_context2_threadtls( &_addr) ; }))

Implements thread_tls_t.sys_context_threadtls.

sys_context2_threadtls

#define sys_context2_threadtls(
   local_var
) (threadcontext_t*) ( (uintptr_t)(local_var) & ~(uintptr_t) (sys_size_threadtls()-1) )

Implements thread_tls_t.sys_context2_threadtls.

sys_size_threadtls

#define sys_size_threadtls() (512*1024)

Implements thread_tls_t.sys_size_threadtls.

sys_thread_threadtls

#define sys_thread_threadtls() ((thread_t*)(&sys_context_threadtls()[1]))

Implements thread_tls_t.sys_thread_threadtls.

#define sys_context_threadtls(
   
) ( __extension__ ({ int _addr ; sys_context2_threadtls( &_addr) ; }))
Implements thread_tls_t.sys_context_threadtls.
Defines sys_context_threadtls and other thread context specific functions.
Global generic configurations.
struct thread_tls_t
struct threadcontext_t * sys_context_threadtls(void)
Returns threadcontext_t of the current thread.
struct threadcontext_t * sys_context2_threadtls(void *local_var)
Returns threadcontext_t of the current thread.
size_t sys_size_threadtls(void)
Returns the size in bytes of the thread local storage.
struct thread_t * sys_thread_threadtls(void)
Returns current thread_t object.
#define sys_context2_threadtls(
   local_var
) (threadcontext_t*) ( (uintptr_t)(local_var) & ~(uintptr_t) (sys_size_threadtls()-1) )
Implements thread_tls_t.sys_context2_threadtls.
#define sys_size_threadtls() (512*1024)
Implements thread_tls_t.sys_size_threadtls.
#define sys_thread_threadtls() ((thread_t*)(&sys_context_threadtls()[1]))
Implements thread_tls_t.sys_thread_threadtls.
Close