template<typename T> sprawl::threading::ThreadLocal<T>::ThreadLocal() { pthread_key_create(&m_key, NULL); } template<typename T> sprawl::threading::ThreadLocal<T>::ThreadLocal(T const& value) { pthread_key_create(&m_key, NULL); set(value); } template<typename T> sprawl::threading::ThreadLocal<T>::~ThreadLocal() { pthread_key_delete(m_key); } template<typename T> T* sprawl::threading::ThreadLocal<T>::get() { return reinterpret_cast<T*>(pthread_getspecific(m_key)); } template<typename T> T const* sprawl::threading::ThreadLocal<T>::get() const { return reinterpret_cast<T*>(pthread_getspecific(m_key)); } template<typename T> void sprawl::threading::ThreadLocal<T>::set(T const& value) { T* oldValue = reinterpret_cast<T*>(pthread_getspecific(m_key)); if(oldValue) { *oldValue = value; } else { pthread_setspecific(m_key, (void*)(new T(value))); } } template<typename T> sprawl::threading::ThreadLocal<T*>::ThreadLocal() { pthread_key_create(&m_key, NULL); } template<typename T> sprawl::threading::ThreadLocal<T*>::ThreadLocal(T const* value) { pthread_key_create(&m_key, NULL); set(value); } template<typename T> sprawl::threading::ThreadLocal<T*>::~ThreadLocal() { pthread_key_delete(m_key); } template<typename T> T* sprawl::threading::ThreadLocal<T*>::get() { return reinterpret_cast<T*>(pthread_getspecific(m_key)); } template<typename T> T const* sprawl::threading::ThreadLocal<T*>::get() const { return reinterpret_cast<T*>(pthread_getspecific(m_key)); } template<typename T> void sprawl::threading::ThreadLocal<T*>::set(T const* value) { pthread_setspecific(m_key, (void*)(value)); }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 23398 | ququlala | "Forking branch Mainline of shadauxcat-libsprawl to ququlala-libsprawl." | ||
//guest/ShadauxCat/Sprawl/Mainline/threading/threadlocal_linux.inl | |||||
#1 | 13650 | ShadauxCat |
- Windows implementations of thread and time libraries - Added coroutines - Added some more unit tests, fixed some unit tests in windows environments - Fixed an issue where multi threading was not properly detected on Linux - Fixed the makefiles to build with threading by default on linux - Changed the pool allocator to use thread-local pools instead of locking mutexes - Fixed output of sprawl::string in the StringBuilder library to take length into account - Added string builder options for StringLiteral - Added thread local implementation #review |