diff options
author | Yabin Cui <yabinc@google.com> | 2015-01-26 19:48:54 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2015-01-27 14:23:22 -0800 |
commit | 4a6e5a3b641dd99b658c4c336490371a3a5ae180 (patch) | |
tree | 3048f441498f5d5aed8bb218ecaca5e9a80cbf40 /libcutils/threads.c | |
parent | fb538fb13d930a7398695d1044ceaaf854949018 (diff) | |
download | core-4a6e5a3b641dd99b658c4c336490371a3a5ae180.tar.gz core-4a6e5a3b641dd99b658c4c336490371a3a5ae180.tar.bz2 core-4a6e5a3b641dd99b658c4c336490371a3a5ae180.zip |
Kill HAVE_PTHREADS.
Bug: 19083585
Change-Id: Ic09eb3dd250bc5c5b63cac7998f99f5fa007f407
Diffstat (limited to 'libcutils/threads.c')
-rw-r--r-- | libcutils/threads.c | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/libcutils/threads.c b/libcutils/threads.c index bf182f081..ca600b3b1 100644 --- a/libcutils/threads.c +++ b/libcutils/threads.c @@ -1,22 +1,22 @@ /* ** Copyright (C) 2007, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ #include <cutils/threads.h> -#ifdef HAVE_PTHREADS +#if !defined(_WIN32) void* thread_store_get( thread_store_t* store ) { if (!store->has_tls) @@ -24,8 +24,8 @@ void* thread_store_get( thread_store_t* store ) return pthread_getspecific( store->tls ); } - -extern void thread_store_set( thread_store_t* store, + +extern void thread_store_set( thread_store_t* store, void* value, thread_store_destruct_t destroy) { @@ -42,14 +42,12 @@ extern void thread_store_set( thread_store_t* store, pthread_setspecific( store->tls, value ); } -#endif - -#ifdef HAVE_WIN32_THREADS +#else /* !defined(_WIN32) */ void* thread_store_get( thread_store_t* store ) { if (!store->has_tls) return NULL; - + return (void*) TlsGetValue( store->tls ); } @@ -65,7 +63,7 @@ void thread_store_set( thread_store_t* store, } else while (store->lock_init != -2) { Sleep(10); /* 10ms */ } - + EnterCriticalSection( &store->lock ); if (!store->has_tls) { store->tls = TlsAlloc(); @@ -76,7 +74,7 @@ void thread_store_set( thread_store_t* store, store->has_tls = 1; } LeaveCriticalSection( &store->lock ); - + TlsSetValue( store->tls, value ); } -#endif +#endif /* !defined(_WIN32) */ |