| // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| #include "base/threading/thread_local_storage.h" |
| #include "base/logging.h" |
| ThreadLocalStorage::Slot::Slot(TLSDestructorFunc destructor) { |
| bool ThreadLocalStorage::StaticSlot::Initialize(TLSDestructorFunc destructor) { |
| int error = pthread_key_create(&key_, destructor); |
| void ThreadLocalStorage::StaticSlot::Free() { |
| int error = pthread_key_delete(key_); |
| void* ThreadLocalStorage::StaticSlot::Get() const { |
| return pthread_getspecific(key_); |
| void ThreadLocalStorage::StaticSlot::Set(void* value) { |
| int error = pthread_setspecific(key_, value); |