TLS.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2005 Palmsource, Inc.
00003  * 
00004  * This software is licensed as described in the file LICENSE, which
00005  * you should have received as part of this distribution. The terms
00006  * are also available at http://www.openbinder.org/license.html.
00007  * 
00008  * This software consists of voluntary contributions made by many
00009  * individuals. For the exact contribution history, see the revision
00010  * history and logs, available at http://www.openbinder.org
00011  */
00012 
00013 #ifndef _TLS_H
00014 #define _TLS_H  1
00015 
00016 #include <support/SupportDefs.h>
00017 
00018 #include <SysThread.h>
00019 
00020 // KILL THIS FILE PLEASE!
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 // <support/TLS.h>
00027 
00028 static inline int32_t tls_allocate()
00029 {
00030     int32_t index = -1;
00031     SysTSDAllocate((SysTSDSlotID*)&index, NULL, sysTSDAnonymous);
00032     return index;
00033 }
00034 
00035 static inline void* tls_get(int32_t index)
00036 {
00037     return SysTSDGet((SysTSDSlotID)index);
00038 }
00039 
00040 static inline void tls_set(int32_t index, void *value)
00041 {
00042     SysTSDSet((SysTSDSlotID)index, value);
00043 }
00044 
00045 
00046 #ifdef __cplusplus
00047 }
00048 #endif
00049 
00050 #endif