summaryrefslogtreecommitdiffstats
path: root/libcutils
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2015-01-26 19:48:54 -0800
committerYabin Cui <yabinc@google.com>2015-01-27 14:23:22 -0800
commit4a6e5a3b641dd99b658c4c336490371a3a5ae180 (patch)
tree3048f441498f5d5aed8bb218ecaca5e9a80cbf40 /libcutils
parentfb538fb13d930a7398695d1044ceaaf854949018 (diff)
downloadsystem_core-4a6e5a3b641dd99b658c4c336490371a3a5ae180.zip
system_core-4a6e5a3b641dd99b658c4c336490371a3a5ae180.tar.gz
system_core-4a6e5a3b641dd99b658c4c336490371a3a5ae180.tar.bz2
Kill HAVE_PTHREADS.
Bug: 19083585 Change-Id: Ic09eb3dd250bc5c5b63cac7998f99f5fa007f407
Diffstat (limited to 'libcutils')
-rw-r--r--libcutils/threads.c34
1 files changed, 16 insertions, 18 deletions
diff --git a/libcutils/threads.c b/libcutils/threads.c
index bf182f0..ca600b3 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) */