aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Burke <daveburke@google.com>2012-09-17 20:37:38 -0700
committerElliott Hughes <enh@google.com>2012-09-18 16:55:24 -0700
commit88f1ea8f82e1fcef0d472577f00cd889b796e944 (patch)
tree0724f24ae5ec39c8623a5675f3ee46b61b6676c7
parent77ac158e90712a975f61b7559b8de558f644f48d (diff)
downloadbionic-88f1ea8f82e1fcef0d472577f00cd889b796e944.tar.gz
Make pthread_create more forgiving of invalid sched_policy.
Bug: 7005326 (cherry-pick of e58303249b9e799a4fe84c5a2dfe71518441a6ec.) Change-Id: Ie81494e0f6a71caa6fd9fabbcfc47a23077554d6
-rw-r--r--libc/bionic/pthread.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libc/bionic/pthread.c b/libc/bionic/pthread.c
index 14d2fec53..da3a55152 100644
--- a/libc/bionic/pthread.c
+++ b/libc/bionic/pthread.c
@@ -205,6 +205,8 @@ void __thread_entry(int (*func)(void*), void *arg, void **tls)
pthread_exit((void*) result);
}
+#include <private/logd.h>
+
__LIBC_ABI_PRIVATE__
int _init_thread(pthread_internal_t* thread, pid_t kernel_id, pthread_attr_t* attr,
void* stack_base, bool add_to_thread_list)
@@ -229,7 +231,9 @@ int _init_thread(pthread_internal_t* thread, pid_t kernel_id, pthread_attr_t* at
struct sched_param param;
param.sched_priority = thread->attr.sched_priority;
if (sched_setscheduler(kernel_id, thread->attr.sched_policy, &param) == -1) {
- error = errno;
+ // For back compat reasons, we just warn about possible invalid sched_policy
+ const char* msg = "pthread_create sched_setscheduler call failed: %s\n";
+ __libc_android_log_print(ANDROID_LOG_WARN, "libc", msg, strerror(errno));
}
}